Bazaar developer reference

CvMinorCivAI::GetCurrentFaithFlatBonus(PlayerTypes)

Defined in
CvMinorCivAI.cpp, line 8175
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_GetCurrentFaithFlatBonus

Hooks

static bool BeforeCvMinorCivAI_GetCurrentFaithFlatBonus(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static void AfterCvMinorCivAI_GetCurrentFaithFlatBonus(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvMinorCivAI_GetCurrentFaithFlatBonus(int (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetCurrentFaithFlatBonus>(host, &BeforeCvMinorCivAI_GetCurrentFaithFlatBonus);CivRegisterAfter<CivHooks::CvMinorCivAI_GetCurrentFaithFlatBonus>(host, &AfterCvMinorCivAI_GetCurrentFaithFlatBonus);CivRegisterReplace<CivHooks::CvMinorCivAI_GetCurrentFaithFlatBonus>(host, &ReplaceCvMinorCivAI_GetCurrentFaithFlatBonus);

Code

8175int CvMinorCivAI::GetCurrentFaithFlatBonus(PlayerTypes ePlayer)8176{8177	CvAssertMsg(ePlayer >= 0, "eIndex is expected to be non-negative (invalid Index)");8178	CvAssertMsg(ePlayer < MAX_PLAYERS, "ePlayer is expected to be within maximum bounds (invalid Index)");8179	if(ePlayer < 0 || ePlayer >= MAX_PLAYERS) return 0;81808181	// Minor civ players do not get a bonus8182	if(ePlayer >= MAX_MAJOR_CIVS)8183		return 0;81848185	// Only for Religious trait minors8186	if(GetTrait() != MINOR_CIV_TRAIT_RELIGIOUS)8187		return 0;81888189	int iAmount = 0;8190	if(IsAllies(ePlayer))8191		iAmount += GetFaithFlatAlliesBonus(ePlayer);8192	if(IsFriends(ePlayer))8193		iAmount += GetFaithFlatFriendshipBonus(ePlayer);81948195	// Modify the bonus if called for by our trait8196	int iModifier = GET_PLAYER(ePlayer).GetPlayerTraits()->GetCityStateBonusModifier();8197	if(iModifier > 0)8198	{8199		iAmount *= (iModifier + 100);8200		iAmount /= 100;8201	}82028203	return iAmount;8204}

Calls

Called by