CvPlayer::setAlive(bool, bool)
- Defined in
- CvPlayer.cpp, line 17638
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_setAlive
Hand-placed hooks inside
A replacement for this function that does not call original stops these hooks from running.
Hooks
static bool BeforeCvPlayer_setAlive(CvPlayer* self, bool bNewValue, bool bNotify);static void AfterCvPlayer_setAlive(CvPlayer* self, bool bNewValue, bool bNotify);static void ReplaceCvPlayer_setAlive(void (*original)(CvPlayer*, bool, bool), CvPlayer* self, bool bNewValue, bool bNotify);CivRegisterBefore<CivHooks::CvPlayer_setAlive>(host, &BeforeCvPlayer_setAlive);CivRegisterAfter<CivHooks::CvPlayer_setAlive>(host, &AfterCvPlayer_setAlive);CivRegisterReplace<CivHooks::CvPlayer_setAlive>(host, &ReplaceCvPlayer_setAlive);
Code
17638void CvPlayer::setAlive(bool bNewValue, bool bNotify)17639{17640 CvString strBuffer;17641 int iI;1764217643 if(isAlive() != bNewValue)17644 {17645 m_bAlive = bNewValue;1764617647 GET_TEAM(getTeam()).changeAliveCount((isAlive()) ? 1 : -1);1764817649 GC.getGame().GetGameLeagues()->DoPlayerAliveStatusChanged(GetID());1765017651 // Tell Minor Civ AI what's up so that it knows when to add/remove bonuses for players it's friends with17652 if(isMinorCiv())17653 {17654 GetMinorCivAI()->DoChangeAliveStatus(bNewValue);17655 }1765617657 if(isAlive())17658 {17659 if(!isEverAlive())17660 {17661 m_bEverAlive = true;1766217663 GET_TEAM(getTeam()).changeEverAliveCount(1);17664 }1766517666 if(getNumCities() == 0)17667 {17668 setFoundedFirstCity(false);17669 }1767017671 GET_TEAM(getTeam()).SetKilledByTeam(NO_TEAM);1767217673 if(isSimultaneousTurns() || (GC.getGame().getNumGameTurnActive() == 0) || (GC.getGame().isSimultaneousTeamTurns() && GET_TEAM(getTeam()).isTurnActive()))17674 {17675 setTurnActive(true);17676 }1767717678 gDLL->openSlot(GetID());17679 }17680 else17681 {17682 clearResearchQueue();17683 killUnits();17684 killCities();17685 if(CvPreGame::isNetworkMultiplayerGame() && m_eID == GC.getGame().getActivePlayer())17686 gDLL->netDisconnect();1768717688 if (!GET_TEAM(getTeam()).isAlive())17689 {17690 for (int i = 0; i < MAX_TEAMS; i++)17691 {17692 TeamTypes eTheirTeam = (TeamTypes)i;17693 if (getTeam() != eTheirTeam)17694 {17695 // close both embassies17696 GET_TEAM(getTeam()).CloseEmbassyAtTeam(eTheirTeam);17697 GET_TEAM(eTheirTeam).CloseEmbassyAtTeam(getTeam());1769817699 // cancel any research agreements17700 GET_TEAM(getTeam()).CancelResearchAgreement(eTheirTeam);17701 GET_TEAM(eTheirTeam).CancelResearchAgreement(getTeam());17702 }17703 }17704 }1770517706 // Reset incoming units17707 for(int iLoop = 0; iLoop < MAX_PLAYERS; iLoop++)17708 {17709 PlayerTypes eLoopPlayer = (PlayerTypes) iLoop;17710 SetIncomingUnitCountdown(eLoopPlayer, -1);17711 SetIncomingUnitType(eLoopPlayer, NO_UNIT);17712 }1771317714 GC.getGame().GetGameDeals()->DoCancelAllDealsWithPlayer(GetID());1771517716 // Reset relationships with minor civs17717 for(int iPlayerLoop = MAX_MAJOR_CIVS; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)17718 {17719 PlayerTypes eOtherPlayer = (PlayerTypes) iPlayerLoop;17720 GET_PLAYER(eOtherPlayer).GetMinorCivAI()->ResetFriendshipWithMajor(GetID());17721 }1772217723 setTurnActive(false);1772417725#if defined(CIV_HOST_API)17726 if(!CivHandKeepDeadSlotOpen(GetID()))hand-placed hook: KeepDeadSlotOpen17727#endif17728 gDLL->closeSlot(GetID());1772917730 if(bNotify && !isBarbarian())17731 {17732 Localization::String strMessage = Localization::Lookup("TXT_KEY_MISC_CIV_DESTROYED");17733 strMessage << getCivilizationAdjectiveKey();17734 Localization::String strSummary = Localization::Lookup("TXT_KEY_MISC_CIV_DESTROYED_SHORT");17735 strSummary << getCivilizationShortDescriptionKey();1773617737 for(iI = 0; iI < MAX_PLAYERS; iI++)17738 {17739 const PlayerTypes eOtherPlayer = static_cast<PlayerTypes>(iI);17740 CvPlayerAI& kOtherPlayer = GET_PLAYER(eOtherPlayer);1774117742 if(kOtherPlayer.isAlive() && kOtherPlayer.GetNotifications())17743 {17744 kOtherPlayer.GetNotifications()->Add(NOTIFICATION_PLAYER_KILLED, strMessage.toUTF8(), strSummary.toUTF8(), -1, -1, -1);17745 }17746 }1774717748 GC.getGame().addReplayMessage(REPLAY_MESSAGE_MAJOR_EVENT, GetID(), strMessage.toUTF8(), -1, -1);17749 }1775017751 GC.getGame().testVictory();17752 }1775317754 GC.getGame().setScoreDirty(true);17755 }17756}
Calls
CivHandKeepDeadSlotOpen- CvGame::addReplayMessage(ReplayMessageTypes, PlayerTypes, const CvString &, int, int)
- CvGame::getActivePlayer() const
- CvGame::GetGameDeals()
- CvGame::GetGameLeagues()
- CvGame::getNumGameTurnActive()
- CvGame::isSimultaneousTeamTurns() const
- CvGame::setScoreDirty(bool)
- CvGame::testVictory()
- CvGameDeals::DoCancelAllDealsWithPlayer(PlayerTypes)
- CvGameLeagues::DoPlayerAliveStatusChanged(PlayerTypes)
- CvGlobals::getDLLIFace()
- CvGlobals::getGame()
- CvMinorCivAI::DoChangeAliveStatus(bool)
- CvMinorCivAI::ResetFriendshipWithMajor(PlayerTypes)
- CvNotifications::Add(NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayer::clearResearchQueue()
- CvPlayer::getCivilizationAdjectiveKey() const
- CvPlayer::getCivilizationShortDescriptionKey() const
- CvPlayer::GetID() const
- CvPlayer::GetMinorCivAI() const
- CvPlayer::GetNotifications() const
- CvPlayer::getNumCities() const
- CvPlayer::getTeam() const
- CvPlayer::isAlive() const
- CvPlayer::isBarbarian() const
- CvPlayer::isEverAlive() const
- CvPlayer::isMinorCiv() const
- CvPlayer::isSimultaneousTurns() const
- CvPlayer::killCities()
- CvPlayer::killUnits()
- CvPlayer::setFoundedFirstCity(bool)
- CvPlayer::SetIncomingUnitCountdown(PlayerTypes, int)
- CvPlayer::SetIncomingUnitType(PlayerTypes, UnitTypes)
- CvPlayer::setTurnActive(bool, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPreGame::isNetworkMultiplayerGame()
CvString::CvStringCvString::CvString- CvTeam::CancelResearchAgreement(TeamTypes)
- CvTeam::changeAliveCount(int)
- CvTeam::changeEverAliveCount(int)
- CvTeam::CloseEmbassyAtTeam(TeamTypes)
- CvTeam::getTeam(TeamTypes)
- CvTeam::isAlive() const
- CvTeam::isTurnActive() const
- CvTeam::SetKilledByTeam(TeamTypes)
FAutoVariable::operator const PlayerTypes &FAutoVariable::operator=ICvEngineUtility1::closeSlotICvEngineUtility1::netDisconnectICvEngineUtility1::openSlotLocalization::LookupLocalization::String::toUTF8operator<<