]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some minor cleanup, use intrusive lists for bot projectile finding
authorMario <mario@smbclan.net>
Mon, 29 Aug 2016 12:11:26 +0000 (22:11 +1000)
committerMario <mario@smbclan.net>
Mon, 29 Aug 2016 12:11:26 +0000 (22:11 +1000)
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/server/g_world.qc
qcsrc/server/spawnpoints.qc

index 409f0eab69e6ee53eea47178efe69449c6cbf754..1fdb8d6ad6773a78cba7a24b428b15c389193357 100644 (file)
@@ -517,16 +517,15 @@ METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponen
         if(fire & 2)
         if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
         {
-            entity rock;
             bool rockfound = false;
-            for(rock = NULL; (rock = find(rock, classname, "rocket")); ) if(rock.realowner == actor)
+            IL_EACH(g_projectiles, it.realowner == actor && it.classname == "rocket",
             {
-                if(!rock.rl_detonate_later)
+                if(!it.rl_detonate_later)
                 {
-                    rock.rl_detonate_later = true;
+                    it.rl_detonate_later = true;
                     rockfound = true;
                 }
-            }
+            });
             if(rockfound)
                 sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
         }
index 2206cc57d13bf4dfb2df8791671808d4ee269241..1428cc4fa9d8395b74522f6fc69f2e616d3f90ea 100644 (file)
@@ -363,15 +363,14 @@ METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity
         if(WEP_CVAR_SEC(mortar, remote_detonateprimary))
         {
             bool nadefound = false;
-            entity nade;
-            for(nade = NULL; (nade = find(nade, classname, "grenade")); ) if(nade.realowner == actor)
+            IL_EACH(g_projectiles, it.realowner == actor && it.classname == "grenade",
             {
-                if(!nade.gl_detonate_later)
+                if(!it.gl_detonate_later)
                 {
-                    nade.gl_detonate_later = true;
+                    it.gl_detonate_later = true;
                     nadefound = true;
                 }
-            }
+            });
             if(nadefound)
                 sound(actor, CH_WEAPON_B, SND_ROCKET_DET, VOL_BASE, ATTN_NORM);
         }
index 8e8afde9fd8e33d3d62359f87a1fed2c78c7ab1d..e3bc706979607a7aa99c1e7a6203027cd67dd417 100644 (file)
@@ -1334,32 +1334,32 @@ entity FindIntermission()
        local   float cyc;
 
 // look for info_intermission first
-       spot = find (NULL, classname, "info_intermission");
+       spot = find(NULL, classname, "info_intermission");
        if (spot)
        {       // pick a random one
                cyc = random() * 4;
                while (cyc > 1)
                {
-                       spot = find (spot, classname, "info_intermission");
+                       spot = find(spot, classname, "info_intermission");
                        if (!spot)
-                               spot = find (spot, classname, "info_intermission");
+                               spot = find(spot, classname, "info_intermission");
                        cyc = cyc - 1;
                }
                return spot;
        }
 
 // then look for the start position
-       spot = find (NULL, classname, "info_player_start");
+       spot = find(NULL, classname, "info_player_start");
        if (spot)
                return spot;
 
 // testinfo_player_start is only found in regioned levels
-       spot = find (NULL, classname, "testplayerstart");
+       spot = find(NULL, classname, "testplayerstart");
        if (spot)
                return spot;
 
 // then look for the start position
-       spot = find (NULL, classname, "info_player_deathmatch");
+       spot = find(NULL, classname, "info_player_deathmatch");
        if (spot)
                return spot;
 
index f4dfe0432022927095c423f578b4599e58bfe27d..59cc052af421942def992c27f5103fd3d08d00d8 100644 (file)
@@ -334,7 +334,7 @@ entity SelectSpawnPoint(entity this, bool anypoint)
        float teamcheck;
        entity spot, firstspot;
 
-       spot = find (NULL, classname, "testplayerstart");
+       spot = find(NULL, classname, "testplayerstart");
        if (spot)
                return spot;