Bazaar developer reference

CvPlayerReligions::GetCostNextProphet(bool, bool, bool) const

Defined in
CvReligionClasses.cpp, line 2992
Class
CvPlayerReligions
Hook name
CivHooks::CvPlayerReligions_GetCostNextProphet

Hooks

static bool BeforeCvPlayerReligions_GetCostNextProphet(const CvPlayerReligions* self, bool bIncludeBeliefDiscounts, bool bAdjustForSpeedDifficulty, bool bExcludeFree, int& result);static void AfterCvPlayerReligions_GetCostNextProphet(const CvPlayerReligions* self, bool bIncludeBeliefDiscounts, bool bAdjustForSpeedDifficulty, bool bExcludeFree, int& result);static int ReplaceCvPlayerReligions_GetCostNextProphet(int (*original)(const CvPlayerReligions*, bool, bool, bool), const CvPlayerReligions* self, bool bIncludeBeliefDiscounts, bool bAdjustForSpeedDifficulty, bool bExcludeFree);CivRegisterBefore<CivHooks::CvPlayerReligions_GetCostNextProphet>(host, &BeforeCvPlayerReligions_GetCostNextProphet);CivRegisterAfter<CivHooks::CvPlayerReligions_GetCostNextProphet>(host, &AfterCvPlayerReligions_GetCostNextProphet);CivRegisterReplace<CivHooks::CvPlayerReligions_GetCostNextProphet>(host, &ReplaceCvPlayerReligions_GetCostNextProphet);

Code

2990/// How much will the next prophet cost this player?2991#if defined(MOD_GLOBAL_TRULY_FREE_GP)2992int CvPlayerReligions::GetCostNextProphet(bool bIncludeBeliefDiscounts, bool bAdjustForSpeedDifficulty, bool bExcludeFree) const2993#else2994int CvPlayerReligions::GetCostNextProphet(bool bIncludeBeliefDiscounts, bool bAdjustForSpeedDifficulty) const2995#endif2996{2997#if defined(MOD_GLOBAL_TRULY_FREE_GP)2998	int iCost = GC.getGame().GetGameReligions()->GetFaithGreatProphetNumber(GetNumProphetsSpawned(bExcludeFree) + 1);2999#else3000	int iCost = GC.getGame().GetGameReligions()->GetFaithGreatProphetNumber(m_iNumProphetsSpawned + 1);3001#endif30023003	// Boost to faith due to belief?3004	ReligionTypes ePlayerReligion = GetReligionCreatedByPlayer();3005	if (bIncludeBeliefDiscounts && ePlayerReligion > RELIGION_PANTHEON)3006	{3007		const CvReligion* pReligion = NULL;3008		pReligion = GC.getGame().GetGameReligions()->GetReligion(ePlayerReligion, m_pPlayer->GetID());3009		if(pReligion)3010		{3011			int iProphetCostMod = pReligion->m_Beliefs.GetProphetCostModifier();30123013			if(iProphetCostMod != 0)3014			{3015				iCost *= (100 + iProphetCostMod);3016				iCost /= 100;3017			}3018		}3019	}30203021	if (bAdjustForSpeedDifficulty)3022	{3023		// Adjust for game speed3024		iCost *= GC.getGame().getGameSpeedInfo().getTrainPercent();3025		iCost /= 100;30263027		// Adjust for difficulty3028		if(!m_pPlayer->isHuman() && !m_pPlayer->IsAITeammateOfHuman() && !m_pPlayer->isBarbarian())3029		{3030			iCost *= GC.getGame().getHandicapInfo().getAITrainPercent();3031			iCost /= 100;3032		}3033	}30343035	return iCost;3036}

Calls

Called by