CvCity::GetFoodProduction(int) const
- Defined in
- CvCity.cpp, line 5926
- Class
- CvCity
- Hook name
CivHooks::CvCity_GetFoodProduction
Hooks
static bool BeforeCvCity_GetFoodProduction(const CvCity* self, int iExcessFood, int& result);static void AfterCvCity_GetFoodProduction(const CvCity* self, int iExcessFood, int& result);static int ReplaceCvCity_GetFoodProduction(int (*original)(const CvCity*, int), const CvCity* self, int iExcessFood);CivRegisterBefore<CivHooks::CvCity_GetFoodProduction>(host, &BeforeCvCity_GetFoodProduction);CivRegisterAfter<CivHooks::CvCity_GetFoodProduction>(host, &AfterCvCity_GetFoodProduction);CivRegisterReplace<CivHooks::CvCity_GetFoodProduction>(host, &ReplaceCvCity_GetFoodProduction);
Code
5925/// Convert extra food to production if building a unit built partially from food5926int CvCity::GetFoodProduction(int iExcessFood) const5927{5928 int iRtnValue;59295930 if(iExcessFood <= 0)5931 {5932 iRtnValue = 0;5933 }5934 else if(iExcessFood <= 2)5935 {5936 iRtnValue = iExcessFood * 100;5937 }5938 else if(iExcessFood > 2 && iExcessFood <= 4)5939 {5940 iRtnValue = 200 + (iExcessFood - 2) * 50;5941 }5942 else5943 {5944 iRtnValue = 300 + (iExcessFood - 4) * 25;5945 }59465947 return (iRtnValue / 100);5948}