Bazaar developer reference

CvPlayer::getGrowthThreshold(int) const

Defined in
CvPlayer.cpp, line 26282
Class
CvPlayer
Hook name
CivHooks::CvPlayer_getGrowthThreshold

Hooks

static bool BeforeCvPlayer_getGrowthThreshold(const CvPlayer* self, int iPopulation, int& result);static void AfterCvPlayer_getGrowthThreshold(const CvPlayer* self, int iPopulation, int& result);static int ReplaceCvPlayer_getGrowthThreshold(int (*original)(const CvPlayer*, int), const CvPlayer* self, int iPopulation);CivRegisterBefore<CivHooks::CvPlayer_getGrowthThreshold>(host, &BeforeCvPlayer_getGrowthThreshold);CivRegisterAfter<CivHooks::CvPlayer_getGrowthThreshold>(host, &AfterCvPlayer_getGrowthThreshold);CivRegisterReplace<CivHooks::CvPlayer_getGrowthThreshold>(host, &ReplaceCvPlayer_getGrowthThreshold);

Code

26282int CvPlayer::getGrowthThreshold(int iPopulation) const26283{26284	CvAssertMsg(iPopulation > 0, "Population of city should be at least 1. Please show Jon this and send your last 5 autosaves.");2628526286	int iThreshold;2628726288	int iBaseThreshold = /*15*/ GC.getBASE_CITY_GROWTH_THRESHOLD();2628926290	int iExtraPopThreshold = int((iPopulation-1) * /*6*/ GC.getCITY_GROWTH_MULTIPLIER());2629126292	iBaseThreshold += iExtraPopThreshold;26293	iExtraPopThreshold = (int) pow(double(iPopulation-1), (double) /*1.8*/ GC.getCITY_GROWTH_EXPONENT());2629426295	iThreshold = iBaseThreshold + iExtraPopThreshold;2629626297	if(isMinorCiv())26298	{26299		iThreshold *= GC.getMINOR_CIV_GROWTH_PERCENT();26300		iThreshold /= 100;26301	}2630226303	iThreshold *= GC.getGame().getGameSpeedInfo().getGrowthPercent();26304	iThreshold /= 100;2630526306	iThreshold *= GC.getGame().getStartEraInfo().getGrowthPercent();26307	iThreshold /= 100;2630826309	if(!isHuman() && !IsAITeammateOfHuman() && !isBarbarian())26310	{26311		iThreshold *= GC.getGame().getHandicapInfo().getAIGrowthPercent();26312		iThreshold /= 100;2631326314		iThreshold *= std::max(0, ((GC.getGame().getHandicapInfo().getAIPerEraModifier() * GetCurrentEra()) + 100));26315		iThreshold /= 100;26316	}2631726318	return std::max(1, iThreshold);26319}

Calls

Called by