CvCityCulture::GetCultureFromNaturalWonders() const
- Defined in
- CvCultureClasses.cpp, line 5284
- Class
- CvCityCulture
- Hook name
CivHooks::CvCityCulture_GetCultureFromNaturalWonders
Hooks
static bool BeforeCvCityCulture_GetCultureFromNaturalWonders(const CvCityCulture* self, int& result);static void AfterCvCityCulture_GetCultureFromNaturalWonders(const CvCityCulture* self, int& result);static int ReplaceCvCityCulture_GetCultureFromNaturalWonders(int (*original)(const CvCityCulture*), const CvCityCulture* self);CivRegisterBefore<CivHooks::CvCityCulture_GetCultureFromNaturalWonders>(host, &BeforeCvCityCulture_GetCultureFromNaturalWonders);CivRegisterAfter<CivHooks::CvCityCulture_GetCultureFromNaturalWonders>(host, &AfterCvCityCulture_GetCultureFromNaturalWonders);CivRegisterReplace<CivHooks::CvCityCulture_GetCultureFromNaturalWonders>(host, &ReplaceCvCityCulture_GetCultureFromNaturalWonders);
Code
5283/// City's current culture from natural wonders5284int CvCityCulture::GetCultureFromNaturalWonders() const5285{5286 int iRtnValue = 0;5287 CvPlot* pLoopPlot;52885289 // Look at all workable Plots5290#if defined(MOD_GLOBAL_CITY_WORKING)5291 for(int iPlotLoop = 0; iPlotLoop < m_pCity->GetNumWorkablePlots(); iPlotLoop++)5292#else5293 for(int iPlotLoop = 0; iPlotLoop < NUM_CITY_PLOTS; iPlotLoop++)5294#endif5295 {5296 if(iPlotLoop != CITY_HOME_PLOT)5297 {5298 pLoopPlot = m_pCity->GetCityCitizens()->GetCityPlotFromIndex(iPlotLoop);52995300 if(pLoopPlot != NULL)5301 {5302 // Is this a Plot this City controls?5303 if(pLoopPlot->getWorkingCity() != NULL && pLoopPlot->getWorkingCity()->GetID() == m_pCity->GetID())5304 {5305 // Working the Plot?5306 if (m_pCity->GetCityCitizens()->IsWorkingPlot(pLoopPlot))5307 {5308 if(pLoopPlot->getFeatureType() != NO_FEATURE && GC.getFeatureInfo(pLoopPlot->getFeatureType())->IsNaturalWonder())5309 {5310 iRtnValue += pLoopPlot->getYield(YIELD_CULTURE);5311 }5312 }5313 }5314 }5315 }5316 }5317 return iRtnValue;5318}
Calls
- CvCity::GetCityCitizens() const
- CvCity::GetID() const
- CvCity::GetNumWorkablePlots(int) const
- CvCityCitizens::GetCityPlotFromIndex(int) const
- CvCityCitizens::IsWorkingPlot(const CvPlot *) const
- CvFeatureInfo::IsNaturalWonder() const
- CvGlobals::getFeatureInfo(FeatureTypes)
- CvPlot::getFeatureType() const
- CvPlot::getWorkingCity() const
- CvPlot::getYield(YieldTypes) const