]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Intrusify more stuff
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 14:13:25 +0000 (00:13 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 14:13:25 +0000 (00:13 +1000)
qcsrc/common/triggers/target/music.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/triggers/teleporters.qh
qcsrc/common/triggers/trigger/teleport.qc
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc

index c8e3539283d76652c719e3ce0f82c9c5669f441d..0fde9e043904d00f4093fe74bcc45a9ce0a74b52 100644 (file)
@@ -12,6 +12,9 @@ REGISTER_NET_LINKED(ENT_CLIENT_TRIGGER_MUSIC)
 
 #ifdef SVQC
 
+IntrusiveList g_targetmusic_list;
+STATIC_INIT(g_targetmusic_list) { g_targetmusic_list = IL_NEW(); }
+
 // values:
 //   volume
 //   noise
@@ -37,7 +40,8 @@ void target_music_reset(entity this)
 }
 void target_music_kill()
 {
-       FOREACH_ENTITY_CLASS("target_music", true, {
+       IL_EACH(g_targetmusic_list, true,
+       {
                it.volume = 0;
         if (it.targetname == "")
             target_music_sendto(it, MSG_ALL, 1);
@@ -65,6 +69,7 @@ spawnfunc(target_music)
        this.reset = target_music_reset;
        if(!this.volume)
                this.volume = 1;
+       IL_PUSH(g_targetmusic_list, this);
        if(this.targetname == "")
                target_music_sendto(this, MSG_INIT, 1);
        else
@@ -72,7 +77,7 @@ spawnfunc(target_music)
 }
 void TargetMusic_RestoreGame()
 {
-       FOREACH_ENTITY_CLASS("target_music", true,
+       IL_EACH(g_targetmusic_list, true,
        {
                if(it.targetname == "")
                        target_music_sendto(it, MSG_INIT, 1);
index a1a38d39e1a95e24459d2a2c4c1a5bb857c7de27..b5e97b1fc7516f1a082a82d69c354a85f4b8594e 100644 (file)
@@ -267,10 +267,10 @@ void teleport_findtarget(entity this)
 
 entity Teleport_Find(vector mi, vector ma)
 {
-       entity e;
-       for(e = NULL; (e = find(e, classname, "trigger_teleport")); )
-               if(WarpZoneLib_BoxTouchesBrush(mi, ma, e, NULL))
-                       return e;
+       IL_EACH(g_teleporters, WarpZoneLib_BoxTouchesBrush(mi, ma, it, NULL),
+       {
+               return it;
+       });
        return NULL;
 }
 
index 513ed3e26928460e636b36940fa0d009c5213241..6f5f8cb76e21bec6f941b85e2aebccd767b5ba21 100644 (file)
@@ -1,5 +1,8 @@
 #pragma once
 
+IntrusiveList g_teleporters;
+STATIC_INIT(g_teleporters) { g_teleporters = IL_NEW(); }
+
 .entity pusher;
 const float TELEPORT_FLAG_SOUND = 1;
 const float TELEPORT_FLAG_PARTICLES = 2;
index 05bb13c710e7ed4c4289f92acbd137c82da3505c..c3de654609ff5e0db36ad1bf01e4b314b3283023 100644 (file)
@@ -99,6 +99,8 @@ spawnfunc(trigger_teleport)
                return;
        }
 
+       IL_PUSH(g_teleporters, this);
+
        this.teleport_next = teleport_first;
        teleport_first = this;
 }
@@ -106,6 +108,8 @@ spawnfunc(trigger_teleport)
 NET_HANDLE(ENT_CLIENT_TRIGGER_TELEPORT, bool isnew)
 {
        this.classname = "trigger_teleport";
+       if(isnew)
+               IL_PUSH(g_teleporters, this);
        int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
        this.spawnflags = ReadInt24_t();
        this.active = ReadByte();
index d23c29675a70fa7bc5d2944922f143ee6a7c9a28..577f4074e25747bae4a4d4afa56050d7a5d47ed2 100644 (file)
@@ -1214,7 +1214,7 @@ float havocbot_moveto(entity this, vector pos)
        this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_LINKING;
 
        // if pos is inside a teleport, then let's mark it as teleport waypoint
-       FOREACH_ENTITY_CLASS("trigger_teleport", WarpZoneLib_BoxTouchesBrush(pos, pos, it, NULL),
+       IL_EACH(g_teleporters, WarpZoneLib_BoxTouchesBrush(pos, pos, it, NULL),
        {
                wp.wpflags |= WAYPOINTFLAG_TELEPORT;
                this.lastteleporttime = 0;
index 5b63aa4e0c99c3e52389d6c6bf9ae1826895aa8f..c7b784827516460e86be269f1f09baeec7445b7b 100644 (file)
@@ -1768,7 +1768,8 @@ float WinningCondition_RanOutOfSpawns()
                }
        ));
 
-       FOREACH_ENTITY_CLASS("info_player_deathmatch", true, LAMBDA(
+       FOREACH_ENTITY_CLASS("info_player_deathmatch", true,
+       {
                switch(it.team)
                {
                        case NUM_TEAM_1: team1_score = 1; break;
@@ -1776,7 +1777,7 @@ float WinningCondition_RanOutOfSpawns()
                        case NUM_TEAM_3: team3_score = 1; break;
                        case NUM_TEAM_4: team4_score = 1; break;
                }
-       ));
+       });
 
        ClearWinners();
        if(team1_score + team2_score + team3_score + team4_score == 0)
index 1d9dc662017f7743f212588be4a96ba0c8a7f1c4..7083d3a8f607b00564338e2298d5cb0b91558e65 100644 (file)
@@ -5,6 +5,8 @@
 
 #include <server/teamplay.qh>
 
+IntrusiveList g_invasion_spawns;
+STATIC_INIT(g_invasion_spawns) { g_invasion_spawns = IL_NEW(); }
 
 float autocvar_g_invasion_round_timelimit;
 float autocvar_g_invasion_spawnpoint_spawn_delay;
@@ -18,6 +20,7 @@ spawnfunc(invasion_spawnpoint)
        if(!g_invasion) { delete(this); return; }
 
        this.classname = "invasion_spawnpoint";
+       IL_PUSH(g_invasion_spawns, this);
 
        if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already
        if(this.monsterid) {
@@ -52,7 +55,7 @@ entity invasion_PickSpawn()
 {
        RandomSelection_Init();
 
-       FOREACH_ENTITY_CLASS("invasion_spawnpoint", true,
+       IL_EACH(g_invasion_spawns, true,
        {
                RandomSelection_Add(it, 0, string_null, 1, ((time >= it.spawnshieldtime) ? 0.2 : 1)); // give recently used spawnpoints a very low rating
                it.spawnshieldtime = time + autocvar_g_invasion_spawnpoint_spawn_delay;