From: Mario Date: Sun, 21 Aug 2016 15:08:23 +0000 (+1000) Subject: Intrusify spawnpoints X-Git-Tag: xonotic-v0.8.2~663^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=7dec2b9c692306b16558fe84bae4df9a24a8f637;p=xonotic%2Fxonotic-data.pk3dir.git Intrusify spawnpoints --- diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index 47c4f4c20..dc60b95c3 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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 diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 374e65e1e..568084045 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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(); } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index c7b784827..df55a4bec 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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) { diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index d3b212700..8a10a6d75 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -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); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index c1288b569..4b3d404bf 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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), diff --git a/qcsrc/server/spawnpoints.qc b/qcsrc/server/spawnpoints.qc index 567217933..f4dfe0432 100644 --- a/qcsrc/server/spawnpoints.qc +++ b/qcsrc/server/spawnpoints.qc @@ -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); }