]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/effects/qc/rubble.qh
Merge branch 'martin-t/whoosh' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / effects / qc / rubble.qh
index 83a6941213d627dbeca64e0174cc9e662696310e..6eda9b15ef29d2b5c60a7b48e3651fcb5a538485 100644 (file)
@@ -3,9 +3,12 @@
 #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
@@ -17,7 +20,7 @@ void RubbleLimit(string cname, float limit, void(entity) deleteproc)
                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)
@@ -41,6 +44,7 @@ entity RubbleNew(string cname)
        entity e = spawn();
        e.classname = cname;
        e.creationtime = time;
+       IL_PUSH(g_rubble, e);
        return e;
 }