Bazaar developer reference

CvCity::getProductionDifferenceTimes100(int, int, int, bool, bool) const

Defined in
CvCity.cpp, line 5837
Class
CvCity
Hook name
CivHooks::CvCity_getProductionDifferenceTimes100

Hooks

static bool BeforeCvCity_getProductionDifferenceTimes100(const CvCity* self, int arg0, int arg1, int iProductionModifier, bool bFoodProduction, bool bOverflow, int& result);static void AfterCvCity_getProductionDifferenceTimes100(const CvCity* self, int arg0, int arg1, int iProductionModifier, bool bFoodProduction, bool bOverflow, int& result);static int ReplaceCvCity_getProductionDifferenceTimes100(int (*original)(const CvCity*, int, int, int, bool, bool), const CvCity* self, int arg0, int arg1, int iProductionModifier, bool bFoodProduction, bool bOverflow);CivRegisterBefore<CivHooks::CvCity_getProductionDifferenceTimes100>(host, &BeforeCvCity_getProductionDifferenceTimes100);CivRegisterAfter<CivHooks::CvCity_getProductionDifferenceTimes100>(host, &AfterCvCity_getProductionDifferenceTimes100);CivRegisterReplace<CivHooks::CvCity_getProductionDifferenceTimes100>(host, &ReplaceCvCity_getProductionDifferenceTimes100);

Code

5837int CvCity::getProductionDifferenceTimes100(int /*iProductionNeeded*/, int /*iProduction*/, int iProductionModifier, bool bFoodProduction, bool bOverflow) const5838{5839	VALIDATE_OBJECT5840	// If we're in anarchy, then no Production is done!5841	if(GET_PLAYER(getOwner()).IsAnarchy())5842	{5843		return 0;5844	}5845	// If we're in Resistance, then no Production is done!5846	if(IsResistance() || IsRazing())5847	{5848		return 0;5849	}58505851	int iFoodProduction = ((bFoodProduction) ? GetFoodProduction(getYieldRate(YIELD_FOOD, false) - foodConsumption(true)) : 0);5852	iFoodProduction *= 100;58535854	int iOverflow = ((bOverflow) ? (getOverflowProductionTimes100() + getFeatureProduction() * 100) : 0);58555856	// Sum up difference5857	int iBaseProduction = getBaseYieldRate(YIELD_PRODUCTION) * 100;5858	iBaseProduction += (GetYieldPerPopTimes100(YIELD_PRODUCTION) * getPopulation());58595860	int iModifiedProduction = iBaseProduction * getBaseYieldRateModifier(YIELD_PRODUCTION, iProductionModifier);5861	iModifiedProduction /= 100;58625863	iModifiedProduction += iOverflow;5864	iModifiedProduction += iFoodProduction;58655866	int iTradeYield = GET_PLAYER(m_eOwner).GetTrade()->GetTradeValuesAtCityTimes100(this, YIELD_PRODUCTION);5867	iModifiedProduction += iTradeYield;58685869	return iModifiedProduction;5870}

Calls

Called by