CvPlayer::CheckForMurder(PlayerTypes)
- Defined in
- CvPlayer.cpp, line 18325
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_CheckForMurder
Hooks
static bool BeforeCvPlayer_CheckForMurder(CvPlayer* self, PlayerTypes ePossibleVictimPlayer);static void AfterCvPlayer_CheckForMurder(CvPlayer* self, PlayerTypes ePossibleVictimPlayer);static void ReplaceCvPlayer_CheckForMurder(void (*original)(CvPlayer*, PlayerTypes), CvPlayer* self, PlayerTypes ePossibleVictimPlayer);CivRegisterBefore<CivHooks::CvPlayer_CheckForMurder>(host, &BeforeCvPlayer_CheckForMurder);CivRegisterAfter<CivHooks::CvPlayer_CheckForMurder>(host, &AfterCvPlayer_CheckForMurder);CivRegisterReplace<CivHooks::CvPlayer_CheckForMurder>(host, &ReplaceCvPlayer_CheckForMurder);
Code
18324// check to see if we defeated this other player18325void CvPlayer::CheckForMurder(PlayerTypes ePossibleVictimPlayer)18326{18327 // Cache whether the player is human or not. If the player is killed, the CvPreGame::slotStatus is changed to SS_CLOSED18328 // but the slot status is used to determine if the player is human or not, so it looks like it is an AI!18329 // This should be fixed, but might have unforeseen ramifications so...18330 CvPlayer& kPossibleVictimPlayer = GET_PLAYER(ePossibleVictimPlayer);18331 bool bPossibileVictimIsHuman = kPossibleVictimPlayer.isHuman();1833218333 // This may 'kill' the player if it is deemed that he does not have the proper units to stay alive18334 kPossibleVictimPlayer.verifyAlive();1833518336 // You... you killed him!18337 if(!kPossibleVictimPlayer.isAlive())18338 {18339 GET_TEAM(kPossibleVictimPlayer.getTeam()).SetKilledByTeam(getTeam());18340 kPossibleVictimPlayer.SetEverConqueredBy(m_eID, true);1834118342 // Leader pops up and whines18343 if(!CvPreGame::isNetworkMultiplayerGame()) // Not in MP18344 {18345 if(!bPossibileVictimIsHuman && !kPossibleVictimPlayer.isMinorCiv() && !kPossibleVictimPlayer.isBarbarian())18346 kPossibleVictimPlayer.GetDiplomacyAI()->DoKilledByPlayer(GetID());18347 }1834818349 // do post-dying clean up18350 if (!kPossibleVictimPlayer.isMinorCiv())18351 {18352 for (uint ui = 0; ui < MAX_MAJOR_CIVS; ui++)18353 {18354 PlayerTypes eCleanupPlayer = (PlayerTypes)ui;18355 GET_PLAYER(eCleanupPlayer).GetDiplomacyAI()->KilledPlayerCleanup(kPossibleVictimPlayer.GetID());18356 }18357 }18358 }18359}
Calls
- CvDiplomacyAI::DoKilledByPlayer(PlayerTypes)
- CvDiplomacyAI::KilledPlayerCleanup(PlayerTypes)
- CvPlayer::GetDiplomacyAI() const
- CvPlayer::GetID() const
- CvPlayer::getTeam() const
- CvPlayer::isAlive() const
- CvPlayer::isBarbarian() const
- CvPlayer::isHuman() const
- CvPlayer::isMinorCiv() const
- CvPlayer::SetEverConqueredBy(PlayerTypes, bool)
- CvPlayer::verifyAlive()
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPreGame::isNetworkMultiplayerGame()
- CvTeam::getTeam(TeamTypes)
- CvTeam::SetKilledByTeam(TeamTypes)
FAutoVariable::operator const PlayerTypes &