CvPlayer::getNewCityProductionValue() const
- Defined in
- CvPlayer.cpp, line 26233
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_getNewCityProductionValue
Hooks
static bool BeforeCvPlayer_getNewCityProductionValue(const CvPlayer* self, int& result);static void AfterCvPlayer_getNewCityProductionValue(const CvPlayer* self, int& result);static int ReplaceCvPlayer_getNewCityProductionValue(int (*original)(const CvPlayer*), const CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_getNewCityProductionValue>(host, &BeforeCvPlayer_getNewCityProductionValue);CivRegisterAfter<CivHooks::CvPlayer_getNewCityProductionValue>(host, &AfterCvPlayer_getNewCityProductionValue);CivRegisterReplace<CivHooks::CvPlayer_getNewCityProductionValue>(host, &ReplaceCvPlayer_getNewCityProductionValue);
Code
26233int CvPlayer::getNewCityProductionValue() const26234{26235 if(GC.getSETTLER_PRODUCTION_SPEED() != 0)26236 {26237 return GC.getSETTLER_PRODUCTION_SPEED();26238 }2623926240 int iValue = 0;26241 for(int iJ = 0; iJ < GC.getNumBuildingClassInfos(); iJ++)26242 {26243 const BuildingClassTypes eBuildingClass = static_cast<BuildingClassTypes>(iJ);26244 CvBuildingClassInfo* pkBuildingClassInfo = GC.getBuildingClassInfo(eBuildingClass);26245 if(pkBuildingClassInfo)26246 {26247 const BuildingTypes eBuilding = ((BuildingTypes)(getCivilizationInfo().getCivilizationBuildings(iJ)));26248 if(NO_BUILDING != eBuilding)26249 {26250 CvBuildingEntry* pkBuildingInfo = GC.getBuildingInfo(eBuilding);26251 if(pkBuildingInfo)26252 {26253 if(pkBuildingInfo->GetFreeStartEra() != NO_ERA)26254 {26255 if(GC.getGame().getStartEra() >= pkBuildingInfo->GetFreeStartEra())26256 {26257 iValue += (100 * getProductionNeeded(eBuilding)) / std::max(1, 100 + getProductionModifier(eBuilding));26258 }26259 }26260 }26261 }26262 }26263 }2626426265 iValue *= 100 + GC.getNEW_CITY_BUILDING_VALUE_MODIFIER();26266 iValue /= 100;2626726268 CvGame& kGame = GC.getGame();2626926270 iValue += (GC.getADVANCED_START_CITY_COST() * kGame.getGameSpeedInfo().getGrowthPercent()) / 100;2627126272 int iPopulation = GC.getINITIAL_CITY_POPULATION() + kGame.getStartEraInfo().getFreePopulation();26273 for(int i = 1; i <= iPopulation; ++i)26274 {26275 iValue += (getGrowthThreshold(i) * GC.getADVANCED_START_POPULATION_COST()) / 100;26276 }2627726278 return iValue;26279}
Calls
- CvBuildingEntry::GetFreeStartEra() const
- CvCivilizationInfo::getCivilizationBuildings(int) const
- CvEraInfo::getFreePopulation() const
- CvGame::getGameSpeedInfo() const
- CvGame::getStartEra() const
- CvGame::getStartEraInfo() const
- CvGameSpeedInfo::getGrowthPercent() const
- CvGlobals::getADVANCED_START_CITY_COST()
- CvGlobals::getADVANCED_START_POPULATION_COST()
- CvGlobals::getBuildingClassInfo(BuildingClassTypes)
- CvGlobals::getBuildingInfo(BuildingTypes)
- CvGlobals::getGame()
- CvGlobals::getINITIAL_CITY_POPULATION()
- CvGlobals::getNEW_CITY_BUILDING_VALUE_MODIFIER()
- CvGlobals::getNumBuildingClassInfos()
- CvGlobals::getSETTLER_PRODUCTION_SPEED()
- CvPlayer::getCivilizationInfo() const
- CvPlayer::getGrowthThreshold(int) const
- CvPlayer::getProductionModifier(BuildingTypes, CvString *) const
- CvPlayer::getProductionNeeded(BuildingTypes) const
std::max