]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
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 47c4f4c2079255f64640899eae734a6293e89bec..dc60b95c3d7e0787bf475481b03d7b46a8af4213 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 374e65e1edeb9f7af23e7953638e4aad3f0ac977..5680840456fb8e333c1087442a384ec4b38df1b9 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 c7b784827516460e86be269f1f09baeec7445b7b..df55a4becb945b1b30997df674f577c48d0dcdcb 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 d3b212700996c2d23d6e9fdb5182f9069dd73b91..8a10a6d7525f5c973367b7adef18c16546cfd8a6 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 c1288b5691b590c3776ade3c746ec9b4b3ffce32..4b3d404bf316907a579f6d246330d9f591b257c8 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 567217933fb27f5e519326444d21eb14d7a8f864..f4dfe0432022927095c423f578b4599e58bfe27d 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);
 }