swap teamscore when swapping teams. closes #2004

This commit is contained in:
oy 2019-02-04 16:15:51 +01:00
parent 8c544e6e7c
commit a1b8926f51
3 changed files with 13 additions and 0 deletions

View file

@ -446,6 +446,8 @@ void CGameContext::SwapTeams()
if(m_apPlayers[i] && m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS) if(m_apPlayers[i] && m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS)
m_pController->DoTeamChange(m_apPlayers[i], m_apPlayers[i]->GetTeam()^1, false); m_pController->DoTeamChange(m_apPlayers[i], m_apPlayers[i]->GetTeam()^1, false);
} }
m_pController->SwapTeamscore();
} }
void CGameContext::OnTick() void CGameContext::OnTick()

View file

@ -657,6 +657,16 @@ void IGameController::StartRound()
SetGameState(IGS_WARMUP_GAME, TIMER_INFINITE); SetGameState(IGS_WARMUP_GAME, TIMER_INFINITE);
} }
void IGameController::SwapTeamscore()
{
if(!IsTeamplay())
return;
int Score = m_aTeamscore[TEAM_RED];
m_aTeamscore[TEAM_RED] = m_aTeamscore[TEAM_BLUE];
m_aTeamscore[TEAM_BLUE] = Score;
}
// general // general
void IGameController::Snap(int SnappingClient) void IGameController::Snap(int SnappingClient)
{ {

View file

@ -181,6 +181,7 @@ public:
else else
SetGameState(IGS_WARMUP_USER, Seconds); SetGameState(IGS_WARMUP_USER, Seconds);
} }
void SwapTeamscore();
// general // general
virtual void Snap(int SnappingClient); virtual void Snap(int SnappingClient);