X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Frace.qc;h=328900fa9f5255f56a6dd6570b2b37730b6a0ddf;hp=3701c801522024cf67311eec42c98ec0aef0508b;hb=5fb2f3c4e123910e6291d6337fadd61f5199f5a5;hpb=4d66fbb3a2351be319dd6fc0e481a3dd24e182d4 diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 3701c80152..328900fa9f 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -15,6 +15,9 @@ #include "../lib/warpzone/common.qh" #include "../common/mutators/mutator/waypoints/waypointsprites.qh" +IntrusiveList g_race_targets; +STATIC_INIT(g_race_targets) { g_race_targets = IL_NEW(); } + void race_InitSpectator() { if(g_race_qualifying) @@ -811,19 +814,36 @@ void trigger_race_checkpoint_verify(entity this) g_race_qualifying = qual; + IL_EACH(g_race_targets, true, + { + entity cpt = it; + FOREACH_ENTITY_STRING(target, cpt.targetname, + { + vector org = (this.absmin + this.absmax) * 0.5; + if(cpt.race_checkpoint == 0) + WaypointSprite_SpawnFixed(WP_RaceStart, org, it, sprite, RADARICON_NONE); + else + WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, it, sprite, RADARICON_NONE); + + it.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; + }); + }); + if (race_timed_checkpoint) { if (defrag_ents) { - for (entity cp = NULL; (cp = find(cp, classname, "target_startTimer"));) { - WaypointSprite_UpdateSprites(cp.sprite, WP_RaceStart, WP_Null, WP_Null); - } - for (entity cp = NULL; (cp = find(cp, classname, "target_stopTimer"));) { - WaypointSprite_UpdateSprites(cp.sprite, WP_RaceFinish, WP_Null, WP_Null); - } - for (entity cp = NULL; (cp = find(cp, classname, "target_checkpoint"));) { - if (cp.race_checkpoint == -2) { // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes - defragcpexists = -1; - } - } + IL_EACH(g_race_targets, true, + { + entity cpt = it; + if(it.classname == "target_startTimer" || it.classname == "target_stopTimer") { + FOREACH_ENTITY_STRING(target, cpt.targetname, { + WaypointSprite_UpdateSprites(it.sprite, ((cpt.classname == "target_startTimer") ? WP_RaceStart : WP_RaceFinish), WP_Null, WP_Null); + }); + } + if(it.classname == "target_checkpoint") { + if(it.race_checkpoint == -2) + defragcpexists = -1; // something's wrong with the defrag cp file or it has not been written yet, set defragcpexists to -1 so that it will be rewritten when someone finishes + } + }); if (defragcpexists != -1) { float largest_cp_id = 0; for (entity cp = NULL; (cp = find(cp, classname, "target_checkpoint"));) { @@ -1002,12 +1022,7 @@ spawnfunc(target_checkpoint) // defrag entity race_timed_checkpoint = 1; - if(this.race_checkpoint == 0) - WaypointSprite_SpawnFixed(WP_RaceStart, org, this, sprite, RADARICON_NONE); - else - WaypointSprite_SpawnFixed(WP_RaceCheckpoint, org, this, sprite, RADARICON_NONE); - - this.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; + IL_PUSH(g_race_targets, this); InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET); }