]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Create the g_race_targets, g_racecheckpoints and g_kaballs intrusive lists only when...
authorterencehill <piuntn@gmail.com>
Tue, 30 Mar 2021 23:23:53 +0000 (01:23 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 30 Mar 2021 23:23:53 +0000 (01:23 +0200)
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc
qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qh
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qc
qcsrc/common/gamemodes/gamemode/domination/sv_domination.qh
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qc
qcsrc/common/gamemodes/gamemode/keepaway/sv_keepaway.qh
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/server/race.qc

index 8ec8613cc2951428ea5bfbea15f4ba2e2e62c011..904d26e8f817f7ebd34dde10ab7cf38fc4f9424d 100644 (file)
@@ -2826,6 +2826,7 @@ void ctf_DelayedInit(entity this) // Do this check with a delay so we can wait f
 
 void ctf_Initialize()
 {
 
 void ctf_Initialize()
 {
+       CTF_FLAG = NEW(Flag);
        record_type = CTF_RECORD;
        ctf_captimerecord = stof(db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time")));
 
        record_type = CTF_RECORD;
        ctf_captimerecord = stof(db_get(ServerProgsDB, strcat(GetMapname(), "/captimerecord/time")));
 
index 5c55350cb397fc32b36a402b4c43cc8e6e9d43c8..519cbd0648f49eaaaffceb7863fc4f2abea24ed2 100644 (file)
@@ -20,7 +20,6 @@ REGISTER_MUTATOR(ctf, false)
     MUTATOR_STATIC();
     MUTATOR_ONADD
     {
     MUTATOR_STATIC();
     MUTATOR_ONADD
     {
-               CTF_FLAG = NEW(Flag);
         GameRules_teams(true);
         GameRules_limit_score(autocvar_capturelimit_override);
         GameRules_limit_lead(autocvar_captureleadlimit_override);
         GameRules_teams(true);
         GameRules_limit_score(autocvar_capturelimit_override);
         GameRules_limit_lead(autocvar_captureleadlimit_override);
index 4c208465657777e9b3c800fd45c5f8586d623ff1..ca782cedbb87f04f3ee45fa1f6ad5eddb7519b80 100644 (file)
@@ -671,5 +671,7 @@ void dom_DelayedInit(entity this) // Do this check with a delay so we can wait f
 void dom_Initialize()
 {
        g_domination = true;
 void dom_Initialize()
 {
        g_domination = true;
+       g_dompoints = IL_NEW();
+
        InitializeEntity(NULL, dom_DelayedInit, INITPRIO_GAMETYPE);
 }
        InitializeEntity(NULL, dom_DelayedInit, INITPRIO_GAMETYPE);
 }
index e937a958edfc6d657fc1e0bf68aa06ec80ba730c..bb75feced505f553d56303dc598f825b9f506f0e 100644 (file)
@@ -14,8 +14,6 @@ REGISTER_MUTATOR(dom, false)
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               g_dompoints = IL_NEW();
-
                int fraglimit_override = autocvar_g_domination_point_limit;
                if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
                        fraglimit_override = autocvar_g_domination_roundbased_point_limit;
                int fraglimit_override = autocvar_g_domination_point_limit;
                if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
                        fraglimit_override = autocvar_g_domination_roundbased_point_limit;
index 7239f9e7a4a9c23656d5e4369d9b0f928fd80c05..6952f31389b6e46901c41270c5952906e651c47b 100644 (file)
@@ -267,6 +267,7 @@ void ka_Handler_CheckBall(entity this)
 
 void ka_Initialize() // run at the start of a match, initiates game mode
 {
 
 void ka_Initialize() // run at the start of a match, initiates game mode
 {
+       g_kaballs = IL_NEW();
        ka_Handler = new_pure(ka_Handler);
        setthink(ka_Handler, ka_Handler_CheckBall);
        ka_Handler.nextthink = time;
        ka_Handler = new_pure(ka_Handler);
        setthink(ka_Handler, ka_Handler_CheckBall);
        ka_Handler.nextthink = time;
index 32387a336a361b6b4853bf15c7b0a234e6bf635d..a06960078e25edde2954db46d9c2a955d985c7ec 100644 (file)
@@ -4,6 +4,7 @@
 #include <common/scores.qh>
 void ka_Initialize();
 
 #include <common/scores.qh>
 void ka_Initialize();
 
+IntrusiveList g_kaballs;
 REGISTER_MUTATOR(ka, false)
 {
     MUTATOR_STATIC();
 REGISTER_MUTATOR(ka, false)
 {
     MUTATOR_STATIC();
@@ -24,9 +25,6 @@ const int KA_BALL_COUNT = 1;
 
 entity ka_Handler;
 
 
 entity ka_Handler;
 
-IntrusiveList g_kaballs;
-STATIC_INIT(g_kaballs) { g_kaballs = IL_NEW(); }
-
 void(entity this) havocbot_role_ka_carrier;
 void(entity this) havocbot_role_ka_collector;
 
 void(entity this) havocbot_role_ka_carrier;
 void(entity this) havocbot_role_ka_collector;
 
index c9f2ea740aa4ac4fad7b79540493e2d40d75031a..db39a8a39513a3d80c97816ad3a2bf08d3c1cb94 100644 (file)
@@ -2180,6 +2180,7 @@ void ons_DelayedInit(entity this) // Do this check with a delay so we can wait f
 void ons_Initialize()
 {
        g_onslaught = true;
 void ons_Initialize()
 {
        g_onslaught = true;
+       g_onsshields = IL_NEW();
        ons_captureshield_force = autocvar_g_onslaught_shield_force;
 
        cam = new(objective_camera);
        ons_captureshield_force = autocvar_g_onslaught_shield_force;
 
        cam = new(objective_camera);
index d472dd99956600fcd64202812a06b1fb2a3bfac4..1f98522ba7db9f17054d12275bb91c260b7d1cc6 100644 (file)
@@ -11,7 +11,6 @@ REGISTER_MUTATOR(ons, false)
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
     MUTATOR_STATIC();
        MUTATOR_ONADD
        {
-               g_onsshields = IL_NEW();
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_onslaught_point_limit);
 
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_onslaught_point_limit);
 
index 472a8ec4f630d9c589cf7ed8991a2687e864bc48..c940afb94dc4af026a48549bf321fb9d14c32744 100644 (file)
@@ -66,11 +66,6 @@ void write_recordmarker(entity pl, float tstart, float dt)
 
 IntrusiveList g_race_targets;
 IntrusiveList g_racecheckpoints;
 
 IntrusiveList g_race_targets;
 IntrusiveList g_racecheckpoints;
-STATIC_INIT(g_race)
-{
-       g_race_targets = IL_NEW();
-       g_racecheckpoints = IL_NEW();
-}
 
 void race_InitSpectator()
 {
 
 void race_InitSpectator()
 {
@@ -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;
 
        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);
 
        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);
 }
 
        InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
 }
 
@@ -1136,8 +1137,14 @@ void target_checkpoint_setup(entity this)
 
        race_timed_checkpoint = 1;
 
 
        race_timed_checkpoint = 1;
 
+       if (!g_race_targets)
+               g_race_targets = IL_NEW();
        IL_PUSH(g_race_targets, this);
 
        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);
 }
 
        InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
 }