3 // LordHavoc: rewrote this file, it was really bad code
5 void RubbleLimit(string cname, float limit, void() deleteproc)
12 // remove rubble of the same type if it's at the limit
13 // remove multiple rubble if the limit has been decreased
16 e = findchain(classname,cname);
19 // walk the list and count the entities, find the oldest
20 // initialize our search with the first entity
23 oldesttime = e.creationtime;
25 // compare to all other matching entities
29 if (oldesttime > e.creationtime)
31 oldesttime = e.creationtime;
37 // stop if there are less than the limit already
41 // delete this oldest one and search again
42 WITH(entity, self, oldest, deleteproc());
46 entity RubbleNew(string cname)
48 // spawn a new entity and return it
51 e.creationtime = time;