CvDiplomacyAI::IsAngryAboutSidedWithTheirProtectedMinor(PlayerTypes)
- Defined in
- CvDiplomacyAI.cpp, line 8137
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor
Hooks
static bool BeforeCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor(CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static void AfterCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor(CvDiplomacyAI* self, PlayerTypes ePlayer, bool& result);static bool ReplaceCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor(bool (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor>(host, &BeforeCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor>(host, &AfterCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor>(host, &ReplaceCvDiplomacyAI_IsAngryAboutSidedWithTheirProtectedMinor);
Code
8136// Are we angry about ePlayer choosing to side with one of their protected minors that we attacked/bullied?8137bool CvDiplomacyAI::IsAngryAboutSidedWithTheirProtectedMinor(PlayerTypes ePlayer)8138{8139 CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index. Please send Anton your save file and version.");8140 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index. Please send Anton your save file and version.");8141 if (ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return false;81428143 // Has ePlayer ever done this?8144 if (IsOtherPlayerSidedWithProtectedMinor(ePlayer))8145 {8146 // How long ago?8147 int iTurnsSinceDispute = GetTurnsSinceOtherPlayerSidedWithProtectedMinor(ePlayer);8148 if (iTurnsSinceDispute > -1 && iTurnsSinceDispute < /*25*/ GC.getOPINION_WEIGHT_SIDED_WITH_THEIR_MINOR_NUM_TURNS_UNTIL_FORGIVEN()) //antonjs: consider: scale by game speed8149 {8150 return true;8151 }8152 }8153 return false;8154}