7 class(Rubble).float creationtime;
9 void RubbleLimit(string cname, float limit, void(entity) deleteproc)
16 // remove rubble of the same type if it's at the limit
17 // remove multiple rubble if the limit has been decreased
20 e = findchain(classname, cname);
22 // walk the list and count the entities, find the oldest
23 // initialize our search with the first entity
26 oldesttime = e.creationtime;
28 // compare to all other matching entities
32 if (oldesttime > e.creationtime)
34 oldesttime = e.creationtime;
40 // stop if there are less than the limit already
41 if (c <= limit) break;
43 // delete this oldest one and search again
48 entity RubbleNew(string cname)
50 // spawn a new entity and return it
53 e.creationtime = time;