CvPlayer::calculateTotalYield(YieldTypes) const
- Defined in
- CvPlayer.cpp, line 9640
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_calculateTotalYield
Hooks
static bool BeforeCvPlayer_calculateTotalYield(const CvPlayer* self, YieldTypes eYield, int& result);static void AfterCvPlayer_calculateTotalYield(const CvPlayer* self, YieldTypes eYield, int& result);static int ReplaceCvPlayer_calculateTotalYield(int (*original)(const CvPlayer*, YieldTypes), const CvPlayer* self, YieldTypes eYield);CivRegisterBefore<CivHooks::CvPlayer_calculateTotalYield>(host, &BeforeCvPlayer_calculateTotalYield);CivRegisterAfter<CivHooks::CvPlayer_calculateTotalYield>(host, &AfterCvPlayer_calculateTotalYield);CivRegisterReplace<CivHooks::CvPlayer_calculateTotalYield>(host, &ReplaceCvPlayer_calculateTotalYield);
Code
9640int CvPlayer::calculateTotalYield(YieldTypes eYield) const9641{9642#if defined(MOD_API_UNIFIED_YIELDS)9643 // This is based on the switch in CvEconomicAI::LogMonitor() that calls different methods for culture and faith9644 // I've added this here as a "safe guard"9645 if (eYield == YIELD_CULTURE) {9646 return GetTotalJONSCulturePerTurn();9647 } else if (eYield == YIELD_FAITH) {9648 return GetTotalFaithPerTurn();9649 }9650#endif96519652 const CvCity* pLoopCity;9653 int iTotalYield = 0;9654 int iLoop = 0;9655 9656 for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))9657 {9658 iTotalYield += pLoopCity->getYieldRateTimes100(eYield, false);9659 }96609661 return iTotalYield / 100;9662}