]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/race.qc
Create the g_race_targets, g_racecheckpoints and g_kaballs intrusive lists only when...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / race.qc
index c09cd69ea83cb1db4316cb19936d9dd9a10fef8a..c940afb94dc4af026a48549bf321fb9d14c32744 100644 (file)
@@ -66,11 +66,6 @@ void write_recordmarker(entity pl, float tstart, float dt)
 
 IntrusiveList g_race_targets;
 IntrusiveList g_racecheckpoints;
-STATIC_INIT(g_race)
-{
-       g_race_targets = IL_NEW();
-       g_racecheckpoints = IL_NEW();
-}
 
 void race_InitSpectator()
 {
@@ -286,7 +281,7 @@ void race_send_rankings_cnt(float msg)
        WriteByte(msg, m);
 }
 
-void race_SendRankings(float pos, float prevpos, float del, float msg)
+void race_SendRanking(float pos, float prevpos, float del, float msg)
 {
        WriteHeader(msg, TE_CSQC_RACE);
        WriteByte(msg, RACE_NET_SERVER_RANKINGS);
@@ -344,7 +339,7 @@ void race_SendAll(entity player, bool only_rankings)
        int m = min(RANKINGS_CNT, autocvar_g_cts_send_rankings_cnt);
        race_send_rankings_cnt(MSG_ONE);
        for (int i = 1; i <= m; ++i)
-               race_SendRankings(i, 0, 0, MSG_ONE);
+               race_SendRanking(i, 0, 0, MSG_ONE);
 }
 
 void race_SendStatus(float id, entity e)
@@ -427,7 +422,7 @@ void race_setTime(string map, float t, string myuid, string mynetname, entity e,
                race_send_recordtime(MSG_ALL);
        }
 
-       race_SendRankings(newpos, player_prevpos, 0, MSG_ALL);
+       race_SendRanking(newpos, player_prevpos, 0, MSG_ALL);
        strcpy(rankings_reply, getrankings());
 
        if(newpos == player_prevpos)
@@ -470,7 +465,7 @@ void race_deleteTime(string map, float pos)
                }
        }
 
-       race_SendRankings(pos, 0, 1, MSG_ALL);
+       race_SendRanking(pos, 0, 1, MSG_ALL);
        if(pos == 1)
                race_send_recordtime(MSG_ALL);
 
@@ -1091,8 +1086,14 @@ spawnfunc(trigger_race_checkpoint)
        this.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;
        this.spawn_evalfunc = trigger_race_checkpoint_spawn_evalfunc;
 
+       if (!g_racecheckpoints)
+               g_racecheckpoints = IL_NEW();
        IL_PUSH(g_racecheckpoints, this);
 
+       // trigger_race_checkpoint_verify checks this list too
+       if (!g_race_targets)
+               g_race_targets = IL_NEW();
+
        InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
 }
 
@@ -1136,8 +1137,14 @@ void target_checkpoint_setup(entity this)
 
        race_timed_checkpoint = 1;
 
+       if (!g_race_targets)
+               g_race_targets = IL_NEW();
        IL_PUSH(g_race_targets, this);
 
+       // trigger_race_checkpoint_verify checks this list too
+       if (!g_racecheckpoints)
+               g_racecheckpoints = IL_NEW();
+
        InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
 }