4 void RubbleLimit(string cname, int limit, void(entity) deleteproc)
6 // remove rubble of the same type if it's at the limit
7 // remove multiple rubble if the limit has been decreased
10 // walk the list and count the entities, find the oldest
11 // initialize our search with the first entity
15 // compare to all other matching entities
16 IL_EACH(g_rubble, it.classname == cname,
19 if(!oldest || oldesttime > it.creationtime)
22 oldesttime = it.creationtime;
26 // stop if there are less than the limit already
27 if (c <= limit) break;
29 // delete this oldest one and search again
34 entity RubbleNew(entity e)
36 e.creationtime = time;