diff options
| author | Teetime <anton.tsoulos@yahoo.de> | 2011-10-14 02:40:05 +0200 |
|---|---|---|
| committer | Teetime <anton.tsoulos@yahoo.de> | 2011-10-14 02:40:05 +0200 |
| commit | 5bd8c48b3c3f4e6c0d6fdc3c1b9a7e604ea1f3bb (patch) | |
| tree | c56b72b20bbf051354a6d29fde41f428f7ecc0b5 /src/game/server/gamemodes/zcatch.cpp | |
| parent | 973894f33baae6411b920fb2dce7b92fe4f57343 (diff) | |
| download | zcatch-5bd8c48b3c3f4e6c0d6fdc3c1b9a7e604ea1f3bb.tar.gz zcatch-5bd8c48b3c3f4e6c0d6fdc3c1b9a7e604ea1f3bb.zip | |
moved and overworked wincheck
Diffstat (limited to 'src/game/server/gamemodes/zcatch.cpp')
| -rw-r--r-- | src/game/server/gamemodes/zcatch.cpp | 43 |
1 files changed, 39 insertions, 4 deletions
diff --git a/src/game/server/gamemodes/zcatch.cpp b/src/game/server/gamemodes/zcatch.cpp index b61690cb..fb9af45e 100644 --- a/src/game/server/gamemodes/zcatch.cpp +++ b/src/game/server/gamemodes/zcatch.cpp @@ -20,11 +20,45 @@ void CGameController_zCatch::Tick() DoWincheck(); IGameController::Tick(); } + bool CGameController_zCatch::IsZCatch() { return true; } +void CGameController_zCatch::DoWincheck() +{ + int Players = 0, Players_Spec = 0, Players_SpecExplicit = 0; + + for(int i = 0; i < MAX_CLIENTS; i++) + { + 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(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->GetTeam() != TEAM_SPECTATORS) + GameServer()->m_apPlayers[i]->m_Score += g_Config.m_SvBonus; + } + EndRound(); + } + + IGameController::DoWincheck(); //do also usual wincheck +} + int CGameController_zCatch::OnCharacterDeath(class CCharacter *pVictim, class CPlayer *pKiller, int WeaponID) { int VictimID = pVictim->GetPlayer()->GetCID(); @@ -71,12 +105,12 @@ void CGameController_zCatch::OnPlayerInfoChange(class CPlayer *pP) { if(g_Config.m_SvColorIndicator) { - int num = 161; + int Players = 161; for(int i = 0; i < MAX_CLIENTS; i++) if(GameServer()->m_apPlayers[i] && GameServer()->m_apPlayers[i]->m_CatchedBy == pP->GetCID()) - num -= 10; - pP->m_TeeInfos.m_ColorBody = num * 0x010000 + 0xff00; - pP->m_TeeInfos.m_ColorFeet = num * 0x010000 + 0xff00; + Players -= 10; + pP->m_TeeInfos.m_ColorBody = Players * 0x010000 + 0xff00; + pP->m_TeeInfos.m_ColorFeet = Players * 0x010000 + 0xff00; pP->m_TeeInfos.m_UseCustomColor = 1; } } @@ -142,6 +176,7 @@ void CGameController_zCatch::OnCharacterSpawn(class CCharacter *pChr) } OnPlayerInfoChange(pChr->GetPlayer()); } + void CGameController_zCatch::EndRound() { for(int i = 0; i < MAX_CLIENTS; i++) |