CvCityCulture::GetYieldFromImprovements(YieldTypes) const
- Defined in
- CvCultureClasses.cpp, line 5322
- Class
- CvCityCulture
- Hook name
CivHooks::CvCityCulture_GetYieldFromImprovements
Hooks
static bool BeforeCvCityCulture_GetYieldFromImprovements(const CvCityCulture* self, YieldTypes eYield, int& result);static void AfterCvCityCulture_GetYieldFromImprovements(const CvCityCulture* self, YieldTypes eYield, int& result);static int ReplaceCvCityCulture_GetYieldFromImprovements(int (*original)(const CvCityCulture*, YieldTypes), const CvCityCulture* self, YieldTypes eYield);CivRegisterBefore<CivHooks::CvCityCulture_GetYieldFromImprovements>(host, &BeforeCvCityCulture_GetYieldFromImprovements);CivRegisterAfter<CivHooks::CvCityCulture_GetYieldFromImprovements>(host, &AfterCvCityCulture_GetYieldFromImprovements);CivRegisterReplace<CivHooks::CvCityCulture_GetYieldFromImprovements>(host, &ReplaceCvCityCulture_GetYieldFromImprovements);
Code
5320/// City's current culture from improvements5321#if defined(MOD_API_UNIFIED_YIELDS)5322int CvCityCulture::GetYieldFromImprovements(YieldTypes eYield) const5323#else5324int CvCityCulture::GetCultureFromImprovements() const5325#endif5326{5327 int iRtnValue = 0;5328 CvPlot* pLoopPlot;5329 5330 // Look at all workable Plots5331#if defined(MOD_GLOBAL_CITY_WORKING)5332 for(int iPlotLoop = 0; iPlotLoop < m_pCity->GetNumWorkablePlots(); iPlotLoop++)5333#else5334 for(int iPlotLoop = 0; iPlotLoop < NUM_CITY_PLOTS; iPlotLoop++)5335#endif5336 {5337 if(iPlotLoop != CITY_HOME_PLOT)5338 {5339 pLoopPlot = m_pCity->GetCityCitizens()->GetCityPlotFromIndex(iPlotLoop);53405341 if(pLoopPlot != NULL)5342 {5343 // Is this a Plot this City controls?5344 if(pLoopPlot->getWorkingCity() != NULL && pLoopPlot->getWorkingCity()->GetID() == m_pCity->GetID())5345 {5346 // Working the Plot?5347 if (m_pCity->GetCityCitizens()->IsWorkingPlot(pLoopPlot))5348 {5349 ImprovementTypes eImprovement = pLoopPlot->getImprovementType();5350 if (eImprovement != NO_IMPROVEMENT)5351 {5352 iRtnValue += pLoopPlot->calculateYield(eYield);53535354 CvImprovementEntry* pImprovement = GC.getImprovementInfo(eImprovement);5355 if(pImprovement && pImprovement->GetYieldChange(eYield) > 0)5356 {5357#if defined(MOD_API_UNIFIED_YIELDS)5358 int iAdjacentCulture = pImprovement->GetYieldAdjacentSameType(eYield);5359#else5360 int iAdjacentCulture = pImprovement->GetCultureAdjacentSameType();5361#endif5362 if(iAdjacentCulture > 0)5363 {5364#if defined(MOD_API_UNIFIED_YIELDS)5365 iRtnValue += pLoopPlot->ComputeYieldFromAdjacentImprovement(*pImprovement, eImprovement, eYield);5366#else5367 iRtnValue += pLoopPlot->ComputeCultureFromAdjacentImprovement(*pImprovement, eImprovement);5368#endif5369 }5370 }5371 }5372 }5373 }5374 }5375 }5376 }5377 return iRtnValue;5378}
Calls
- CvCity::GetCityCitizens() const
- CvCity::GetID() const
- CvCity::GetNumWorkablePlots(int) const
- CvCityCitizens::GetCityPlotFromIndex(int) const
- CvCityCitizens::IsWorkingPlot(const CvPlot *) const
- CvGlobals::getImprovementInfo(ImprovementTypes)
- CvImprovementEntry::GetYieldAdjacentSameType(YieldTypes) const
- CvImprovementEntry::GetYieldChange(int) const
- CvPlot::calculateYield(YieldTypes, bool)
- CvPlot::ComputeYieldFromAdjacentImprovement(CvImprovementEntry &, ImprovementTypes, YieldTypes) const
- CvPlot::getImprovementType() const
- CvPlot::getWorkingCity() const