CvDiplomacyAI::IsWantsPeaceWithPlayer(PlayerTypes) const
- Defined in
- CvDiplomacyAI.cpp, line 5476
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_IsWantsPeaceWithPlayer
Hooks
static bool BeforeCvDiplomacyAI_IsWantsPeaceWithPlayer(const CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static void AfterCvDiplomacyAI_IsWantsPeaceWithPlayer(const CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static bool ReplaceCvDiplomacyAI_IsWantsPeaceWithPlayer(bool (*original)(const CvDiplomacyAI*, PlayerTypes), const CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsWantsPeaceWithPlayer>(host, &BeforeCvDiplomacyAI_IsWantsPeaceWithPlayer);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsWantsPeaceWithPlayer>(host, &AfterCvDiplomacyAI_IsWantsPeaceWithPlayer);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsWantsPeaceWithPlayer>(host, &ReplaceCvDiplomacyAI_IsWantsPeaceWithPlayer);
Code
5475/// Do we actually want peace with ePlayer?5476bool CvDiplomacyAI::IsWantsPeaceWithPlayer(PlayerTypes ePlayer) const5477{5478 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");5479 CvAssertMsg(ePlayer < MAX_CIV_PLAYERS, "DIPLOMACY_AI: Invalid Player Index. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");54805481 int iRequestPeaceTurnThreshold = /*4*/ GC.getREQUEST_PEACE_TURN_THRESHOLD();54825483 if(!GET_TEAM(m_pPlayer->getTeam()).canChangeWarPeace(GET_PLAYER(ePlayer).getTeam()))5484 {5485 return false;5486 }54875488 if(GetWantPeaceCounter(ePlayer) >= iRequestPeaceTurnThreshold)5489 {5490 return true;5491 }54925493 return false;5494}