diff options
| author | oy <Tom_Adams@web.de> | 2011-06-19 17:32:00 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-06-19 17:32:00 +0200 |
| commit | c10c7d9ac3410e103b2d2e5b69fb6d7833f6a2e3 (patch) | |
| tree | 5e830b3d8ed1b6f96fa1f7a87b8d9d847e548007 /src/game/server/gamecontroller.cpp | |
| parent | 957b81af0726d89d820e26750d85849745cd2c9c (diff) | |
| download | zcatch-c10c7d9ac3410e103b2d2e5b69fb6d7833f6a2e3.tar.gz zcatch-c10c7d9ac3410e103b2d2e5b69fb6d7833f6a2e3.zip | |
improved sudden death in ctf. Closes #617
Diffstat (limited to 'src/game/server/gamecontroller.cpp')
| -rw-r--r-- | src/game/server/gamecontroller.cpp | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index e687a17f..f0facb8c 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -520,6 +520,8 @@ void IGameController::Tick() } } } + + DoWincheck(); } @@ -658,51 +660,50 @@ bool IGameController::CanChangeTeam(CPlayer *pPlayer, int JoinTeam) return true; } -void IGameController::DoPlayerScoreWincheck() +void IGameController::DoWincheck() { if(m_GameOverTick == -1 && !m_Warmup) { - // gather some stats - int Topscore = 0; - int TopscoreCount = 0; - for(int i = 0; i < MAX_CLIENTS; i++) + if(IsTeamplay()) { - if(GameServer()->m_apPlayers[i]) + // check score win condition + if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[TEAM_RED] >= g_Config.m_SvScorelimit || m_aTeamscore[TEAM_BLUE] >= g_Config.m_SvScorelimit)) || + (g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60)) { - if(GameServer()->m_apPlayers[i]->m_Score > Topscore) - { - Topscore = GameServer()->m_apPlayers[i]->m_Score; - TopscoreCount = 1; - } - else if(GameServer()->m_apPlayers[i]->m_Score == Topscore) - TopscoreCount++; + if(m_aTeamscore[TEAM_RED] != m_aTeamscore[TEAM_BLUE]) + EndRound(); + else + m_SuddenDeath = 1; } } - - // check score win condition - if((g_Config.m_SvScorelimit > 0 && Topscore >= g_Config.m_SvScorelimit) || - (g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60)) + else { - if(TopscoreCount == 1) - EndRound(); - else - m_SuddenDeath = 1; - } - } -} + // gather some stats + int Topscore = 0; + int TopscoreCount = 0; + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(GameServer()->m_apPlayers[i]) + { + if(GameServer()->m_apPlayers[i]->m_Score > Topscore) + { + Topscore = GameServer()->m_apPlayers[i]->m_Score; + TopscoreCount = 1; + } + else if(GameServer()->m_apPlayers[i]->m_Score == Topscore) + TopscoreCount++; + } + } -void IGameController::DoTeamScoreWincheck() -{ - if(m_GameOverTick == -1 && !m_Warmup) - { - // check score win condition - if((g_Config.m_SvScorelimit > 0 && (m_aTeamscore[TEAM_RED] >= g_Config.m_SvScorelimit || m_aTeamscore[TEAM_BLUE] >= g_Config.m_SvScorelimit)) || - (g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60)) - { - if(m_aTeamscore[TEAM_RED] != m_aTeamscore[TEAM_BLUE]) - EndRound(); - else - m_SuddenDeath = 1; + // check score win condition + if((g_Config.m_SvScorelimit > 0 && Topscore >= g_Config.m_SvScorelimit) || + (g_Config.m_SvTimelimit > 0 && (Server()->Tick()-m_RoundStartTick) >= g_Config.m_SvTimelimit*Server()->TickSpeed()*60)) + { + if(TopscoreCount == 1) + EndRound(); + else + m_SuddenDeath = 1; + } } } } |