]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Purge a few cases of FOREACH_ENTITY_ENT
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 12:55:58 +0000 (22:55 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 12:55:58 +0000 (22:55 +1000)
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/weapon/devastator.qc

index fc8a4f190b1be8b6feb8a6f6872e4487aebc7dd0..ec06104824e1c555bc7792f0929787344625c1d2 100644 (file)
@@ -314,9 +314,8 @@ void spiderbot_exit(entity this, int eject)
 {
        vector spot;
 
-       FOREACH_ENTITY_ENT(owner, this.owner,
+       IL_EACH(g_projectiles, it.owner == this.owner && it.classname == "spiderbot_rocket",
        {
-               if(it.classname != "spiderbot_rocket") continue;
                it.realowner = this.owner;
                it.owner = NULL;
        });
index dc1f6ba60a29e16190c54d930e285af683b314d0..5f7a2c31c8a928cbbc5efec1d99e869a0c01a6fc 100644 (file)
@@ -48,16 +48,17 @@ void spiderbot_rocket_guided(entity this)
 
 void spiderbot_guide_release(entity this)
 {
-    FOREACH_ENTITY_ENT(realowner, this.owner,
+    bool donetrace = false;
+    IL_EACH(g_projectiles, it.realowner == this.owner && getthink(it) == spiderbot_rocket_guided,
     {
-        if(i == 0) // something exists, let's trace!
-            crosshair_trace(this.owner);
-
-        if(getthink(it) == spiderbot_rocket_guided)
+        if(!donetrace) // something exists, let's trace!
         {
-            it.pos1 = trace_endpos;
-            setthink(it, spiderbot_rocket_unguided);
+            donetrace = true;
+            crosshair_trace(this.owner);
         }
+
+        it.pos1 = trace_endpos;
+        setthink(it, spiderbot_rocket_unguided);
     });
 }
 
index 5ffe08bad9613ee7303ab9c256d8726e97b13f52..d44ee7ec20842fcc2bdb2bbf4a506356e5c1463f 100644 (file)
@@ -460,10 +460,8 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
         selfdamage = 0;
         teamdamage = 0;
         enemydamage = 0;
-        FOREACH_ENTITY_ENT(realowner, actor,
+        IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
         {
-            if(it.classname != "rocket") continue;
-
             entity rocket = it;
             FOREACH_ENTITY_FLOAT(bot_attack, true,
             {
@@ -486,10 +484,8 @@ METHOD(Devastator, wr_aim, void(entity thiswep, entity actor))
             desirabledamage = desirabledamage - teamdamage;
 
         makevectors(actor.v_angle);
-        FOREACH_ENTITY_ENT(realowner, actor,
+        IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
         {
-            if(it.classname != "rocket") continue;
-
             if(skill > 9) // normal players only do this for the target they are tracking
             {
                    entity rocket = it;