Intrusify spawnpoints
authorMario <mario@smbclan.net>
Sun, 21 Aug 2016 15:08:23 +0000 (01:08 +1000)
committerMario <mario@smbclan.net>
Sun, 21 Aug 2016 15:08:23 +0000 (01:08 +1000)
qcsrc/common/util.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/impulse.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/spawnpoints.qc

index 47c4f4c..dc60b95 100644 (file)
@@ -600,7 +600,7 @@ float cvar_settemp(string tmp_cvar, string tmp_value)
                return 0;
        }
 
-       IL_EACH("saved_cvar_value", it.netname == tmp_cvar,
+       IL_EACH(g_saved_cvars, it.netname == tmp_cvar,
        {
                created_saved_value = -1; // skip creation
                break; // no need to continue
index 374e65e..5680840 100644 (file)
@@ -460,3 +460,6 @@ STATIC_INIT(g_assault_destructibles) { g_assault_destructibles = IL_NEW(); }
 
 IntrusiveList g_assault_objectivedecreasers;
 STATIC_INIT(g_assault_objectivedecreasers) { g_assault_objectivedecreasers = IL_NEW(); }
+
+IntrusiveList g_spawnpoints;
+STATIC_INIT(g_spawnpoints) { g_spawnpoints = IL_NEW(); }
index c7b7848..df55a4b 100644 (file)
@@ -555,6 +555,8 @@ spawnfunc(__init_dedicated_server)
        static_init_late();
        static_init_precache();
 
+       IL_PUSH(g_spawnpoints, e); // just incase
+
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
 }
@@ -1768,7 +1770,7 @@ float WinningCondition_RanOutOfSpawns()
                }
        ));
 
-       FOREACH_ENTITY_CLASS("info_player_deathmatch", true,
+       IL_EACH(g_spawnpoints, true,
        {
                switch(it.team)
                {
index d3b2127..8a10a6d 100644 (file)
@@ -551,7 +551,7 @@ IMPULSE(navwaypoint_unreachable)
        if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
 
        j = 0;
-       FOREACH_ENTITY_CLASS("info_player_deathmatch", true,
+       IL_EACH(g_spawnpoints, true,
        {
                vector org = it.origin;
                tracebox(it.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), it.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
index c1288b5..4b3d404 100644 (file)
@@ -1144,7 +1144,6 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma
 {
     float m, i;
     vector start, org, delta, end, enddown, mstart;
-    entity sp;
 
     m = e.dphitcontentsmask;
     e.dphitcontentsmask = goodcontents | badcontents;
@@ -1200,10 +1199,15 @@ float MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundma
             continue;
 
        // rule 4: we must "see" some spawnpoint or item
-       for(sp = NULL; (sp = find(sp, classname, "info_player_deathmatch")); )
-               if(checkpvs(mstart, sp))
-                       if((traceline(mstart, sp.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
-                               break;
+    entity sp = NULL;
+    IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+    {
+       if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+       {
+               sp = it;
+               break;
+       }
+    });
        if(!sp)
        {
                IL_EACH(g_items, checkpvs(mstart, it),
index 5672179..f4dfe04 100644 (file)
@@ -166,6 +166,7 @@ spawnfunc(info_player_start)
 spawnfunc(info_player_deathmatch)
 {
        this.classname = "info_player_deathmatch";
+       IL_PUSH(g_spawnpoints, this);
        relocate_spawnpoint(this);
 }