Bazaar developer reference

CvCity::GetFaithPerTurn() const

Defined in
CvCity.cpp, line 8554
Class
CvCity
Hook name
CivHooks::CvCity_GetFaithPerTurn

Hooks

static bool BeforeCvCity_GetFaithPerTurn(const CvCity* self, int& result);static void AfterCvCity_GetFaithPerTurn(const CvCity* self, int& result);static int ReplaceCvCity_GetFaithPerTurn(int (*original)(const CvCity*), const CvCity* self);CivRegisterBefore<CivHooks::CvCity_GetFaithPerTurn>(host, &BeforeCvCity_GetFaithPerTurn);CivRegisterAfter<CivHooks::CvCity_GetFaithPerTurn>(host, &AfterCvCity_GetFaithPerTurn);CivRegisterReplace<CivHooks::CvCity_GetFaithPerTurn>(host, &ReplaceCvCity_GetFaithPerTurn);

Code

8554int CvCity::GetFaithPerTurn() const8555{8556	VALIDATE_OBJECT85578558	// No faith during Resistance8559	if(IsResistance() || IsRazing())8560	{8561		return 0;8562	}85638564	int iFaith = GetFaithPerTurnFromBuildings();8565#if defined(MOD_API_UNIFIED_YIELDS)8566	iFaith += GetBaseYieldRateFromSpecialists(YIELD_FAITH);8567	iFaith += (GetYieldPerPopTimes100(YIELD_FAITH) * getPopulation()) / 100;8568#endif8569#if defined(MOD_API_UNIFIED_YIELDS)8570	if (IsRouteToCapitalConnected())8571	{8572		iFaith += GET_PLAYER(getOwner()).GetYieldChangeTradeRoute(YIELD_FAITH);8573		iFaith += GET_PLAYER(getOwner()).GetPlayerTraits()->GetYieldChangeTradeRoute(YIELD_FAITH);8574	}8575#endif85768577#if defined(MOD_GLOBAL_GREATWORK_YIELDTYPES) || defined(MOD_API_UNIFIED_YIELDS)8578	iFaith += GetBaseYieldRateFromGreatWorks(YIELD_FAITH);8579#endif8580	iFaith += GetBaseYieldRateFromTerrain(YIELD_FAITH);8581	iFaith += GetFaithPerTurnFromPolicies();8582#if defined(MOD_API_UNIFIED_YIELDS)8583	iFaith += GetYieldPerTurnFromUnimprovedFeatures(YIELD_FAITH);8584#else8585	iFaith += GetFaithPerTurnFromTraits();8586#endif8587	iFaith += GetFaithPerTurnFromReligion();85888589#if defined(MOD_API_UNIFIED_YIELDS)8590	// Process production into faith8591	iFaith += (getBasicYieldRateTimes100(YIELD_PRODUCTION, false) / 100) * getProductionToYieldModifier(YIELD_FAITH) / 100;85928593	// Faith from having trade routes8594	iFaith += GET_PLAYER(m_eOwner).GetTrade()->GetTradeValuesAtCityTimes100(this, YIELD_FAITH) / 100;8595#endif85968597#if defined(MOD_API_UNIFIED_YIELDS)8598	int iModifier = 100;85998600	// City modifier8601	iModifier = getBaseYieldRateModifier(YIELD_FAITH);86028603	// Puppet?8604	if(IsPuppet())8605	{8606		iModifier += GC.getPUPPET_FAITH_MODIFIER();8607	}86088609	iFaith *= iModifier;8610	iFaith /= 100;8611#else8612	// Puppet?8613	int iModifier = 0;8614	if(IsPuppet())8615	{8616		iModifier = GC.getPUPPET_FAITH_MODIFIER();8617		iFaith *= (100 + iModifier);8618		iFaith /= 100;8619	}8620#endif86218622	return iFaith;8623}

Calls

Called by