diff options
| -rw-r--r-- | src/game/server/gamecontext.h | 2 | ||||
| -rw-r--r-- | src/game/server/gamemodes/zcatch.cpp | 63 | ||||
| -rw-r--r-- | src/game/server/gamemodes/zcatch.h | 2 |
3 files changed, 42 insertions, 25 deletions
diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index eb634a87..5d340613 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -16,7 +16,7 @@ #include "player.h" #define MAX_MUTES 35 -#define ZCATCH_VERSION "0.4.7" +#define ZCATCH_VERSION "0.4.8 BETA" /* Tick diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp index 4a810e04..6200d0e0 100644 --- a/src/game/server/gamemodes/zcatch.cpp +++ b/src/game/server/gamemodes/zcatch.cpp @@ -18,8 +18,9 @@ CGameController_zCatch::CGameController_zCatch(class CGameContext *pGameServer) void CGameController_zCatch::Tick() { - DoWincheck(); IGameController::Tick(); + if(m_GameOverTick == -1) + CalcPlayerColor(); if(m_OldMode != g_Config.m_SvMode) { @@ -30,35 +31,38 @@ void CGameController_zCatch::Tick() void CGameController_zCatch::DoWincheck() { - int Players = 0, Players_Spec = 0, Players_SpecExplicit = 0; - - for(int i = 0; i < MAX_CLIENTS; i++) + if(m_GameOverTick == -1) { - if(GameServer()->m_apPlayers[i]) + int Players = 0, Players_Spec = 0, Players_SpecExplicit = 0; + + for(int i = 0; i < MAX_CLIENTS; i++) { - Players++; - if(GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS) - Players_Spec++; - if(GameServer()->m_apPlayers[i]->m_SpecExplicit == 1) - Players_SpecExplicit++; + if(GameServer()->m_apPlayers[i]) + { + Players++; + if(GameServer()->m_apPlayers[i]->GetTeam() == TEAM_SPECTATORS) + Players_Spec++; + if(GameServer()->m_apPlayers[i]->m_SpecExplicit == 1) + Players_SpecExplicit++; + } } - } - if(Players == 1) - { - //Do nothing - } - else if((Players - Players_Spec == 1) && (Players != Players_Spec) && (Players - Players_SpecExplicit != 1)) - { - for(int i = 0; i < MAX_CLIENTS; i++) + if(Players == 1) { - if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS) - GameServer()->m_apPlayers[i]->m_Score += g_Config.m_SvBonus; + //Do nothing + } + else if((Players - Players_Spec == 1) && (Players != Players_Spec) && (Players - Players_SpecExplicit != 1)) + { + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS) + GameServer()->m_apPlayers[i]->m_Score += g_Config.m_SvBonus; + } + EndRound(); } - EndRound(); - } - IGameController::DoWincheck(); //do also usual wincheck + IGameController::DoWincheck(); //do also usual wincheck + } } int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int WeaponID) @@ -111,7 +115,6 @@ int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CP } // Update colors - OnPlayerInfoChange(pKiller); OnPlayerInfoChange(pVictim->GetPlayer()); return 0; @@ -246,3 +249,15 @@ bool CGameController_zCatch::OnEntity(int Index, vec2 Pos) return false; } + +void CGameController_zCatch::CalcPlayerColor() +{ + for(int i = 0; i < MAX_CLIENTS; i++) + { + CPlayer *pP = GameServer()->m_apPlayers[i]; + if(!pP) + continue; + if(pP->GetTeam() != TEAM_SPECTATORS) + OnPlayerInfoChange(pP); + } +} diff --git a/src/game/server/gamemodes/zcatch.h b/src/game/server/gamemodes/zcatch.h index 4f110a03..af776644 100644 --- a/src/game/server/gamemodes/zcatch.h +++ b/src/game/server/gamemodes/zcatch.h @@ -23,6 +23,8 @@ public: virtual bool OnEntity(int Index, vec2 Pos); virtual bool CanChangeTeam(CPlayer *pPlayer, int JoinTeam); virtual void EndRound(); + + void CalcPlayerColor(); }; #endif |