CvMinorCivAI::SetFriendshipWithMajorTimes100(PlayerTypes, int, bool)
- Defined in
- CvMinorCivAI.cpp, line 6262
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_SetFriendshipWithMajorTimes100
Hooks
static bool BeforeCvMinorCivAI_SetFriendshipWithMajorTimes100(CvMinorCivAI* self, PlayerTypes ePlayer, int iNum, bool bFromQuest);static void AfterCvMinorCivAI_SetFriendshipWithMajorTimes100(CvMinorCivAI* self, PlayerTypes ePlayer, int iNum, bool bFromQuest);static void ReplaceCvMinorCivAI_SetFriendshipWithMajorTimes100(void (*original)(CvMinorCivAI*, PlayerTypes, int, bool), CvMinorCivAI* self, PlayerTypes ePlayer, int iNum, bool bFromQuest);CivRegisterBefore<CivHooks::CvMinorCivAI_SetFriendshipWithMajorTimes100>(host, &BeforeCvMinorCivAI_SetFriendshipWithMajorTimes100);CivRegisterAfter<CivHooks::CvMinorCivAI_SetFriendshipWithMajorTimes100>(host, &AfterCvMinorCivAI_SetFriendshipWithMajorTimes100);CivRegisterReplace<CivHooks::CvMinorCivAI_SetFriendshipWithMajorTimes100>(host, &ReplaceCvMinorCivAI_SetFriendshipWithMajorTimes100);
Code
6261/// Sets the base level of Friendship between this Minor and the specified Major Civ6262void CvMinorCivAI::SetFriendshipWithMajorTimes100(PlayerTypes ePlayer, int iNum, bool bFromQuest)6263{6264 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");6265 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");6266 if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return;62676268 int iOldEffectiveFriendship = GetEffectiveFriendshipWithMajorTimes100(ePlayer);62696270 m_aiFriendshipWithMajorTimes100[ePlayer] = iNum;62716272 int iMinimumFriendship = GC.getMINOR_FRIENDSHIP_AT_WAR();6273 if(GetBaseFriendshipWithMajor(ePlayer) < iMinimumFriendship)6274 m_aiFriendshipWithMajorTimes100[ePlayer] = iMinimumFriendship * 100;62756276 int iNewEffectiveFriendship = GetEffectiveFriendshipWithMajorTimes100(ePlayer);62776278 // Has the friendship in effect changed?6279 if(iOldEffectiveFriendship != iNewEffectiveFriendship)6280 {6281 DoFriendshipChangeEffects(ePlayer, iOldEffectiveFriendship/100, iNewEffectiveFriendship/100, bFromQuest);6282 }62836284 // Update City banners and game info if this is the active player6285 if(ePlayer == GC.getGame().getActivePlayer())6286 {6287 GC.GetEngineUserInterface()->setDirty(GameData_DIRTY_BIT, true);6288 GC.GetEngineUserInterface()->setDirty(CityInfo_DIRTY_BIT, true);6289 }6290}
Calls
- CvGame::getActivePlayer() const
- CvGlobals::GetEngineUserInterface()
- CvGlobals::getGame()
- CvGlobals::getMINOR_FRIENDSHIP_AT_WAR()
- CvMinorCivAI::DoFriendshipChangeEffects(PlayerTypes, int, int, bool, bool)
- CvMinorCivAI::GetBaseFriendshipWithMajor(PlayerTypes) const
- CvMinorCivAI::GetEffectiveFriendshipWithMajorTimes100(PlayerTypes)
ICvUserInterface1::setDirty