]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add intrusive lists for some client side stuff
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 13:15:25 +0000 (23:15 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 13:15:25 +0000 (23:15 +1000)
qcsrc/client/main.qh
qcsrc/client/view.qc
qcsrc/common/effects/qc/rubble.qh
qcsrc/common/gamemodes/gamemode/onslaught/cl_generator.qc

index 9da7547299dd013e27e8e93731fc7599b70948f3..71902647893ea6d3b14ec0dbc9b36cf615a6e299 100644 (file)
@@ -76,6 +76,9 @@ STATIC_INIT(g_radarlinks) { g_radarlinks = IL_NEW(); }
 IntrusiveList g_radaricons;
 STATIC_INIT(g_radaricons) { g_radaricons = IL_NEW(); }
 
+IntrusiveList g_onsgenerators;
+STATIC_INIT(g_onsgenerators) { g_onsgenerators = IL_NEW(); }
+
 bool button_zoom;
 bool spectatorbutton_zoom;
 bool button_attack2;
index 2226200521e27683e51cc5f640324be655ce447c..c60dbb8e4e2820a4603ebf7492a24ba2147fd952 100644 (file)
@@ -1500,9 +1500,10 @@ void CSQC_UpdateView(entity this, float w, float h)
                        }
                }
 
-               if(ons_roundlost)
+               if(ons_roundlost) // TODO: move this junk to a client mutator for onslaught (possible using the WantEventchase hook)
                {
-                       FOREACH_ENTITY_CLASS("onslaught_generator", it.health <= 0, {
+                       IL_EACH(g_onsgenerators, it.health <= 0,
+                       {
                                gen = it;
                                break;
                        });
index 83a6941213d627dbeca64e0174cc9e662696310e..dd3785b68ea2cf65af3fb5ecc5c77f86c0b102e0 100644 (file)
@@ -5,7 +5,10 @@
 entityclass(Rubble);
 class(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;
 }
 
index 2b9470f7750ab2b9fecac82a5abe51590811e6bb..cbba9a9aaa87bc23d183b18b224f9fd508d91080 100644 (file)
@@ -143,11 +143,14 @@ void generator_damage(entity this, float hp)
        setsize(this, GENERATOR_MIN, GENERATOR_MAX);
 }
 
-void generator_construct(entity this)
+void generator_construct(entity this, bool isnew)
 {
        this.netname = "Generator";
        this.classname = "onslaught_generator";
 
+       if(isnew)
+               IL_PUSH(g_onsgenerators, this);
+
        setorigin(this, this.origin);
        setmodel(this, MDL_ONS_GEN);
        setsize(this, GENERATOR_MIN, GENERATOR_MAX);
@@ -199,7 +202,7 @@ NET_HANDLE(ENT_CLIENT_GENERATOR, bool isnew)
                        this.count = 40;
 
                generator_changeteam(this);
-               generator_construct(this);
+               generator_construct(this, isnew);
        }
 
        if(sf & GSF_STATUS)