From: Mario Date: Mon, 29 Aug 2016 12:11:26 +0000 (+1000) Subject: Some minor cleanup, use intrusive lists for bot projectile finding X-Git-Tag: xonotic-v0.8.2~643 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=943fbae4366e5354f1caaa88419353dfa5c05910;p=xonotic%2Fxonotic-data.pk3dir.git Some minor cleanup, use intrusive lists for bot projectile finding --- diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 409f0eab6..1fdb8d6ad 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -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); } diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 2206cc57d..1428cc4fa 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -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); } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8e8afde9f..e3bc70697 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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; diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index f4dfe0432..59cc052af 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -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;