#ifdef CSQC
entityclass(Rubble);
-class(Rubble).float creationtime;
+classfield(Rubble).float creationtime;
-void RubbleLimit(string cname, float limit, void(entity) deleteproc)
+IntrusiveList g_rubble;
+STATIC_INIT(g_rubble) { g_rubble = IL_NEW(); }
+
+void RubbleLimit(string cname, int limit, void(entity) deleteproc)
{
// remove rubble of the same type if it's at the limit
// remove multiple rubble if the limit has been decreased
entity oldest = NULL;
float oldesttime = 0;
// compare to all other matching entities
- FOREACH_ENTITY_CLASS(cname, true,
+ IL_EACH(g_rubble, it.classname == cname,
{
++c;
if(!oldest || oldesttime > it.creationtime)
entity e = spawn();
e.classname = cname;
e.creationtime = time;
+ IL_PUSH(g_rubble, e);
return e;
}