CvPlayer::GetNumUnitsSuppliedByPopulation() const
- Defined in
- CvPlayer.cpp, line 9742
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_GetNumUnitsSuppliedByPopulation
Hooks
static bool BeforeCvPlayer_GetNumUnitsSuppliedByPopulation(const CvPlayer* self, int& result);static void AfterCvPlayer_GetNumUnitsSuppliedByPopulation(const CvPlayer* self, int& result);static int ReplaceCvPlayer_GetNumUnitsSuppliedByPopulation(int (*original)(const CvPlayer*), const CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_GetNumUnitsSuppliedByPopulation>(host, &BeforeCvPlayer_GetNumUnitsSuppliedByPopulation);CivRegisterAfter<CivHooks::CvPlayer_GetNumUnitsSuppliedByPopulation>(host, &AfterCvPlayer_GetNumUnitsSuppliedByPopulation);CivRegisterReplace<CivHooks::CvPlayer_GetNumUnitsSuppliedByPopulation>(host, &ReplaceCvPlayer_GetNumUnitsSuppliedByPopulation);
Code
9741/// Units supplied from Difficulty Level9742int CvPlayer::GetNumUnitsSuppliedByPopulation() const9743{9744#if defined(MOD_TRAITS_EXTRA_SUPPLY)9745 // Don't need a test here for MOD_TRAITS_EXTRA_SUPPLY being enabled, as if it isn't GetExtraSupplyPerPopulation() will return 09746 return getTotalPopulation() * (getHandicapInfo().getProductionFreeUnitsPopulationPercent() + m_pTraits->GetExtraSupplyPerPopulation()) / 100;9747#else9748 return getTotalPopulation() * getHandicapInfo().getProductionFreeUnitsPopulationPercent() / 100;9749#endif9750}