Hooks
static bool BeforeCvMinorCivAI_DoMajorBullyGold(CvMinorCivAI* self, PlayerTypes eBully, int iGold);static void AfterCvMinorCivAI_DoMajorBullyGold(CvMinorCivAI* self, PlayerTypes eBully, int iGold);static void ReplaceCvMinorCivAI_DoMajorBullyGold(void (*original)(CvMinorCivAI*, PlayerTypes, int), CvMinorCivAI* self, PlayerTypes eBully, int iGold);CivRegisterBefore<CivHooks::CvMinorCivAI_DoMajorBullyGold>(host, &BeforeCvMinorCivAI_DoMajorBullyGold);CivRegisterAfter<CivHooks::CvMinorCivAI_DoMajorBullyGold>(host, &AfterCvMinorCivAI_DoMajorBullyGold);CivRegisterReplace<CivHooks::CvMinorCivAI_DoMajorBullyGold>(host, &ReplaceCvMinorCivAI_DoMajorBullyGold);
Code
9468void CvMinorCivAI::DoMajorBullyGold(PlayerTypes eBully, int iGold)9469{9470 CvAssertMsg(eBully >= 0, "eBully is expected to be non-negative (invalid Index)");9471 CvAssertMsg(eBully < MAX_MAJOR_CIVS, "eBully is expected to be within maximum bounds (invalid Index)");9472 if(eBully < 0 || eBully >= MAX_MAJOR_CIVS) return;94739474 int iBullyMetric = CalculateBullyMetric(eBully, /*bForUnit*/false);9475 bool bSuccess = CanMajorBullyGold(eBully, iBullyMetric);9476 int iOldFriendshipTimes100 = GetEffectiveFriendshipWithMajorTimes100(eBully);94779478 if(bSuccess)9479 {9480 CvAssertMsg(iGold >= 0, "iGold is expected to be non-negative. Please send Anton your save file and version.");9481 9482 if(GC.getGame().getActivePlayer() == eBully)9483 {9484 int iBullyGold = 0;9485 gDLL->GetSteamStat(ESTEAMSTAT_BULLIEDGOLD, &iBullyGold);94869487 iBullyGold += iGold;94889489 gDLL->SetSteamStat(ESTEAMSTAT_BULLIEDGOLD, iBullyGold);9490 }94919492 GET_PLAYER(eBully).GetTreasury()->ChangeGold(iGold);9493 DoBulliedByMajorReaction(eBully, GC.getMINOR_FRIENDSHIP_DROP_BULLY_GOLD_SUCCESS());9494 9495#if defined(MOD_EVENTS_MINORS_INTERACTION)9496 if (MOD_EVENTS_MINORS_INTERACTION) {9497 GAMEEVENTINVOKE_HOOK(GAMEEVENT_PlayerBullied, eBully, GetPlayer()->GetID(), iGold, -1, -1, -1);9498 }9499#endif9500 }95019502 // Logging9503 GET_PLAYER(eBully).GetDiplomacyAI()->LogMinorCivBullyGold(GetPlayer()->GetID(), iOldFriendshipTimes100, GetEffectiveFriendshipWithMajorTimes100(eBully), iGold, bSuccess, iBullyMetric);95049505 GC.GetEngineUserInterface()->setDirty(GameData_DIRTY_BIT, true);9506}