3 // LordHavoc: rewrote this file, it was really bad code
5 void RubbleLimit(string cname, float limit, void() deleteproc)
15 // remove rubble of the same type if it's at the limit
16 // remove multiple rubble if the limit has been decreased
19 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
44 // delete this oldest one and search again
51 entity RubbleNew(string cname)
54 // spawn a new entity and return it
57 e.creationtime = time;