]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Spawn g_team_entities only if teamplay is enabled
authorterencehill <piuntn@gmail.com>
Sun, 28 Jul 2019 16:13:20 +0000 (18:13 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 28 Jul 2019 16:13:20 +0000 (18:13 +0200)
qcsrc/common/gamemodes/sv_rules.qc
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index a4a4bcd196deb0ac37eb3dad58e807a980908b89..8a86ad7ca79ba66a7959946678fbc6cf09ed01ad 100644 (file)
@@ -8,6 +8,7 @@ void GameRules_teams(bool value)
         serverflags |= SERVERFLAG_TEAMPLAY;
         teamplay = 1;
         cvar_set("teamplay", "2");  // DP needs this for sending proper getstatus replies.
+        Team_InitTeams();
         GameRules_spawning_teams(true);
     } else {
        serverflags &= ~SERVERFLAG_TEAMPLAY;
index ff9438e76d84b205679a05982d5b8bc1eb0b57f3..2839817657262724b38ea8d086b53052fd1ca79a 100644 (file)
@@ -46,7 +46,7 @@ string autocvar_g_forced_team_pink;
 
 entity g_team_entities[NUM_TEAMS]; ///< Holds global team entities.
 
-STATIC_INIT(g_team_entities)
+void Team_InitTeams()
 {
        for (int i = 0; i < NUM_TEAMS; ++i)
        {
index 33f9d02d7e6b01da87c6dd86e6217b3ab546aa95..2774e4a8328155cecfb6ae6f2dcfa04aef56b57c 100644 (file)
@@ -12,6 +12,8 @@ bool lockteams;
 
 // ========================== Global teams API ================================
 
+void Team_InitTeams();
+
 /// \brief Returns the global team entity at the given index.
 /// \param[in] index Index of the team.
 /// \return Global team entity at the given index.