GameRules: make `GameRules_teams(true)` imply `have_team_spawns = -1`
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 27 Aug 2017 05:53:28 +0000 (15:53 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 27 Aug 2017 05:53:28 +0000 (15:53 +1000)
13 files changed:
qcsrc/common/gamemodes/gamemode/nexball/nexball.qc
qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh
qcsrc/common/gamemodes/sv_rules.qc
qcsrc/common/gamemodes/sv_rules.qh
qcsrc/server/mutators/mutator/gamemode_assault.qh
qcsrc/server/mutators/mutator/gamemode_ca.qh
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_domination.qh
qcsrc/server/mutators/mutator/gamemode_freezetag.qh
qcsrc/server/mutators/mutator/gamemode_invasion.qh
qcsrc/server/mutators/mutator/gamemode_keyhunt.qh
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/mutators/mutator/gamemode_tdm.qh

index be00469..163cc38 100644 (file)
@@ -1158,7 +1158,6 @@ REGISTER_MUTATOR(nb, g_nexball)
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_nexball_goallimit);
                GameRules_limit_lead(autocvar_g_nexball_goalleadlimit);
-               have_team_spawns = -1; // request team spawns
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
index f276895..7f24349 100644 (file)
@@ -13,7 +13,6 @@ REGISTER_MUTATOR(ons, false)
 
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_onslaught_point_limit);
-               have_team_spawns = -1; // request team spawns
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
index 38e3fb2..a4041f0 100644 (file)
@@ -8,13 +8,20 @@ void GameRules_teams(bool value)
         serverflags |= SERVERFLAG_TEAMPLAY;
         teamplay = 1;
         cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
+        GameRules_spawning_teams(true);
     } else {
        serverflags &= ~SERVERFLAG_TEAMPLAY;
        teamplay = 0;
        cvar_set("teamplay", "0");  // DP needs this for sending proper getstatus replies.
+       GameRules_spawning_teams(false);
     }
 }
 
+void GameRules_spawning_teams(bool value)
+{
+    have_team_spawns = value ? -1 : 0;
+}
+
 bool _GameRules_score_enabled = true;
 void GameRules_score_enabled(bool value)
 {
index 588d8da..33083b3 100644 (file)
@@ -4,6 +4,11 @@
 void GameRules_teams(bool value);
 
 /**
+ * Used to disable team spawns in team modes
+ */
+void GameRules_spawning_teams(bool value);
+
+/**
  * Disabling score disables the "score" column on the scoreboard
  */
 void GameRules_score_enabled(bool value);
index dc46279..abe89ec 100644 (file)
@@ -7,7 +7,6 @@ void assault_ScoreRules();
 REGISTER_MUTATOR(as, false)
 {
        GameRules_teams(true);
-       have_team_spawns = -1; // request team spawns
 
        MUTATOR_ONADD
        {
index 5069c01..6d4786e 100644 (file)
@@ -56,8 +56,7 @@ REGISTER_MUTATOR(ca, false)
         GameRules_limit_score(autocvar_g_ca_point_limit);
         GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
 
-               if (autocvar_g_ca_team_spawns)
-                       have_team_spawns = -1; // request team spawns
+        GameRules_spawning_teams(autocvar_g_ca_team_spawns);
        }
 
        MUTATOR_ONREMOVE
index 930e93b..f54511f 100644 (file)
@@ -15,7 +15,6 @@ REGISTER_MUTATOR(ctf, false)
                GameRules_teams(true);
         GameRules_limit_score(autocvar_capturelimit_override);
         GameRules_limit_lead(autocvar_captureleadlimit_override);
-               have_team_spawns = -1; // request team spawns
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
index 3fcca2e..19ba2f9 100644 (file)
@@ -24,7 +24,6 @@ REGISTER_MUTATOR(dom, false)
                GameRules_teams(true);
         GameRules_limit_score(fraglimit_override);
         GameRules_limit_lead(autocvar_g_domination_point_leadlimit);
-               have_team_spawns = -1; // request team spawns
        }
 
        MUTATOR_ONREMOVE
index 2274180..69b8577 100644 (file)
@@ -19,8 +19,7 @@ REGISTER_MUTATOR(ft, false)
         GameRules_limit_score(autocvar_g_freezetag_point_limit);
         GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit);
 
-               if (autocvar_g_freezetag_team_spawns)
-                       have_team_spawns = -1; // request team spawns
+        GameRules_spawning_teams(autocvar_g_freezetag_team_spawns);
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
index aad484c..1b5853d 100644 (file)
@@ -25,8 +25,7 @@ REGISTER_MUTATOR(inv, false)
                if (autocvar_g_invasion_teams >= 2)
                {
                        GameRules_teams(true);
-                       if (autocvar_g_invasion_team_spawns)
-                               have_team_spawns = -1; // request team spawns
+                       GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
                }
        }
 
index 3903caa..5b0fb5b 100644 (file)
@@ -18,8 +18,7 @@ REGISTER_MUTATOR(kh, false)
                GameRules_teams(true);
         GameRules_limit_score(autocvar_g_keyhunt_point_limit);
         GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit);
-               if (autocvar_g_keyhunt_team_spawns)
-                       have_team_spawns = -1; // request team spawns
+        GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns);
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE
index 84ca96f..2dae101 100644 (file)
@@ -448,8 +448,6 @@ void rc_SetLimits()
                if(race_teams >= 4) teams |= BIT(3);
 
                race_teams = teams; // now set it?
-
-               have_team_spawns = -1; // request team spawns
        }
        else
                race_teams = 0;
index 5946f84..bfff9cc 100644 (file)
@@ -18,8 +18,7 @@ REGISTER_MUTATOR(tdm, false)
                GameRules_teams(true);
                GameRules_limit_score(autocvar_g_tdm_point_limit);
         GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
-               if (autocvar_g_tdm_team_spawns)
-                       have_team_spawns = -1; // request team spawns
+        GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
        }
 
        MUTATOR_ONROLLBACK_OR_REMOVE