CvPlot::getUnitPower(PlayerTypes) const
- Defined in
- CvPlot.cpp, line 3033
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_getUnitPower
Hooks
static bool BeforeCvPlot_getUnitPower(const CvPlot* self, PlayerTypes eOwner, int& result);static void AfterCvPlot_getUnitPower(const CvPlot* self, PlayerTypes eOwner, int& result);static int ReplaceCvPlot_getUnitPower(int (*original)(const CvPlot*, PlayerTypes), const CvPlot* self, PlayerTypes eOwner);CivRegisterBefore<CivHooks::CvPlot_getUnitPower>(host, &BeforeCvPlot_getUnitPower);CivRegisterAfter<CivHooks::CvPlot_getUnitPower>(host, &AfterCvPlot_getUnitPower);CivRegisterReplace<CivHooks::CvPlot_getUnitPower>(host, &ReplaceCvPlot_getUnitPower);
Code
3033int CvPlot::getUnitPower(PlayerTypes eOwner) const3034{3035 const IDInfo* pUnitNode;3036 const CvUnit* pLoopUnit;3037 int iCount;30383039 iCount = 0;30403041 pUnitNode = headUnitNode();30423043 while(pUnitNode != NULL)3044 {3045 pLoopUnit = GetPlayerUnit(*pUnitNode);3046 pUnitNode = nextUnitNode(pUnitNode);30473048 if(!pLoopUnit) continue;30493050 if((eOwner == NO_PLAYER) || (pLoopUnit->getOwner() == eOwner))3051 {3052 for(int iI = 0; iI < GC.getNumFlavorTypes(); iI++)3053 {3054 if(GC.getFlavorTypes((FlavorTypes)iI) == "FLAVOR_OFFENSE" ||3055 GC.getFlavorTypes((FlavorTypes)iI) == "FLAVOR_DEFENSE")3056 {3057 iCount += pLoopUnit->getUnitInfo().GetFlavorValue(iI);3058 }3059 }3060 }3061 }30623063 return iCount;3064}