CvDiplomacyAI::IsDenounceAcceptable(PlayerTypes, bool)
- Defined in
- CvDiplomacyAI.cpp, line 21537
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_IsDenounceAcceptable
Hooks
static bool BeforeCvDiplomacyAI_IsDenounceAcceptable(CvDiplomacyAI* self, PlayerTypes ePlayer, bool bBias, bool& result);static void AfterCvDiplomacyAI_IsDenounceAcceptable(CvDiplomacyAI* self, PlayerTypes ePlayer, bool bBias, bool& result);static bool ReplaceCvDiplomacyAI_IsDenounceAcceptable(bool (*original)(CvDiplomacyAI*, PlayerTypes, bool), CvDiplomacyAI* self, PlayerTypes ePlayer, bool bBias);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsDenounceAcceptable>(host, &BeforeCvDiplomacyAI_IsDenounceAcceptable);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsDenounceAcceptable>(host, &AfterCvDiplomacyAI_IsDenounceAcceptable);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsDenounceAcceptable>(host, &ReplaceCvDiplomacyAI_IsDenounceAcceptable);
Code
21536// Does this player feel it's time to denounce ePlayer?21537bool CvDiplomacyAI::IsDenounceAcceptable(PlayerTypes ePlayer, bool bBias)21538{21539 // Can't denounce with a civ you're at war with21540 if(GET_TEAM(GetTeam()).isAtWar(GET_PLAYER(ePlayer).getTeam()) || GC.getGame().isOption(GAMEOPTION_ALWAYS_WAR))21541 {21542 return false;21543 }2154421545 // If we've already denounced, it's no good21546 if(IsDenouncedPlayer(ePlayer))21547 return false;2154821549 // If we're friends, return false - this is handled in IsDenounceFriendAcceptable21550 if(IsDoFAccepted(ePlayer))21551 return false;2155221553 int iWeight = GetDenounceWeight(ePlayer, bBias);21554 if(iWeight >= 18)21555 return true;2155621557 return false;21558}
Calls
- CvDiplomacyAI::GetDenounceWeight(PlayerTypes, bool)
- CvDiplomacyAI::GetTeam()
- CvDiplomacyAI::IsDenouncedPlayer(PlayerTypes) const
- CvDiplomacyAI::IsDoFAccepted(PlayerTypes) const
- CvGame::isOption(GameOptionTypes) const
- CvGlobals::getGame()
- CvPlayer::getTeam() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvTeam::getTeam(TeamTypes)
- CvTeam::isAtWar(TeamTypes) const