From: terencehill Date: Sun, 28 Jul 2019 16:13:20 +0000 (+0200) Subject: Spawn g_team_entities only if teamplay is enabled X-Git-Tag: xonotic-v0.8.5~507^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=24b166d9195a878778a49a92eb5979551819c004;p=xonotic%2Fxonotic-data.pk3dir.git Spawn g_team_entities only if teamplay is enabled --- diff --git a/qcsrc/common/gamemodes/sv_rules.qc b/qcsrc/common/gamemodes/sv_rules.qc index a4a4bcd19..8a86ad7ca 100644 --- a/qcsrc/common/gamemodes/sv_rules.qc +++ b/qcsrc/common/gamemodes/sv_rules.qc @@ -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; diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index ff9438e76..283981765 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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) { diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 33f9d02d7..2774e4a83 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -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.