CvCity::GetPurchaseCostFromProduction(int)
- Defined in
- CvCity.cpp, line 5334
- Class
- CvCity
- Hook name
CivHooks::CvCity_GetPurchaseCostFromProduction
Hooks
static bool BeforeCvCity_GetPurchaseCostFromProduction(CvCity* self, int iProduction, int& result);static void AfterCvCity_GetPurchaseCostFromProduction(CvCity* self, int iProduction, int& result);static int ReplaceCvCity_GetPurchaseCostFromProduction(int (*original)(CvCity*, int), CvCity* self, int iProduction);CivRegisterBefore<CivHooks::CvCity_GetPurchaseCostFromProduction>(host, &BeforeCvCity_GetPurchaseCostFromProduction);CivRegisterAfter<CivHooks::CvCity_GetPurchaseCostFromProduction>(host, &AfterCvCity_GetPurchaseCostFromProduction);CivRegisterReplace<CivHooks::CvCity_GetPurchaseCostFromProduction>(host, &ReplaceCvCity_GetPurchaseCostFromProduction);
Code
5333/// Cost of Purchasing something based on the amount of Production it requires to construct5334int CvCity::GetPurchaseCostFromProduction(int iProduction)5335{5336 VALIDATE_OBJECT5337 int iPurchaseCost;53385339 // Gold per Production5340 int iPurchaseCostBase = iProduction* /*30*/ GC.getGOLD_PURCHASE_GOLD_PER_PRODUCTION();5341 // Cost ramps up5342 iPurchaseCost = (int) pow((double) iPurchaseCostBase, (double) /*0.75f*/ GC.getHURRY_GOLD_PRODUCTION_EXPONENT());53435344 // Hurry Mod (Policies, etc.)5345 HurryTypes eHurry = (HurryTypes) GC.getInfoTypeForString("HURRY_GOLD");53465347 if(eHurry != NO_HURRY)5348 {5349 int iHurryMod = GET_PLAYER(getOwner()).getHurryModifier(eHurry);53505351 if(iHurryMod != 0)5352 {5353 iPurchaseCost *= (100 + iHurryMod);5354 iPurchaseCost /= 100;5355 }5356 }53575358 // Game Speed modifier5359 iPurchaseCost *= GC.getGame().getGameSpeedInfo().getHurryPercent();5360 iPurchaseCost /= 100;53615362 return iPurchaseCost;5363}
Calls
- CvCity::getOwner() const
- CvGame::getGameSpeedInfo() const
- CvGameSpeedInfo::getHurryPercent() const
- CvGlobals::getGame()
- CvGlobals::getGOLD_PURCHASE_GOLD_PER_PRODUCTION()
- CvGlobals::getHURRY_GOLD_PRODUCTION_EXPONENT()
- CvGlobals::getInfoTypeForString(const char *, bool) const
- CvPlayer::getHurryModifier(HurryTypes) const
- CvPlayerAI::getPlayer(PlayerTypes)
pow