CvUnitEntry::GetCargoSpace() const
- Defined in
- CvUnitClasses.cpp, line 1280
- Class
- CvUnitEntry
- Hook name
CivHooks::CvUnitEntry_GetCargoSpace
Hooks
static bool BeforeCvUnitEntry_GetCargoSpace(const CvUnitEntry* self, int& result);static void AfterCvUnitEntry_GetCargoSpace(const CvUnitEntry* self, int& result);static int ReplaceCvUnitEntry_GetCargoSpace(int (*original)(const CvUnitEntry*), const CvUnitEntry* self);CivRegisterBefore<CivHooks::CvUnitEntry_GetCargoSpace>(host, &BeforeCvUnitEntry_GetCargoSpace);CivRegisterAfter<CivHooks::CvUnitEntry_GetCargoSpace>(host, &AfterCvUnitEntry_GetCargoSpace);CivRegisterReplace<CivHooks::CvUnitEntry_GetCargoSpace>(host, &ReplaceCvUnitEntry_GetCargoSpace);
Code
1279/// Total cargo space from all free promotions1280int CvUnitEntry::GetCargoSpace() const1281{1282 int rtnValue = 0;12831284 for(int iLoop = 0; iLoop < GC.getNumPromotionInfos(); iLoop++)1285 {1286 const PromotionTypes ePromotion = static_cast<PromotionTypes>(iLoop);1287 CvPromotionEntry* pkPromotionInfo = GC.getPromotionInfo(ePromotion);1288 if(pkPromotionInfo)1289 {1290 if(GetFreePromotions(iLoop))1291 {1292 const int iVal = pkPromotionInfo->GetCargoChange();1293 rtnValue += iVal;1294 }1295 }1296 }12971298 return rtnValue;1299}