CvUnit::GetGreatGeneralStackMovement() const
- Defined in
- CvUnit.cpp, line 18736
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_GetGreatGeneralStackMovement
Hooks
static bool BeforeCvUnit_GetGreatGeneralStackMovement(const CvUnit* self, int& result);static void AfterCvUnit_GetGreatGeneralStackMovement(const CvUnit* self, int& result);static int ReplaceCvUnit_GetGreatGeneralStackMovement(int (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_GetGreatGeneralStackMovement>(host, &BeforeCvUnit_GetGreatGeneralStackMovement);CivRegisterAfter<CivHooks::CvUnit_GetGreatGeneralStackMovement>(host, &AfterCvUnit_GetGreatGeneralStackMovement);CivRegisterReplace<CivHooks::CvUnit_GetGreatGeneralStackMovement>(host, &ReplaceCvUnit_GetGreatGeneralStackMovement);
Code
18736int CvUnit::GetGreatGeneralStackMovement() const18737{18738 int iRtnValue = baseMoves() * GC.getMOVE_DENOMINATOR();1873918740 CvPlot* pLoopPlot = plot();18741 IDInfo* pUnitNode;18742 CvUnit* pLoopUnit;1874318744 if(pLoopPlot != NULL)18745 {18746 // If there are Units here, loop through them18747 if(pLoopPlot->getNumUnits() > 0)18748 {18749 pUnitNode = pLoopPlot->headUnitNode();1875018751 while(pUnitNode != NULL)18752 {18753 pLoopUnit = ::getUnit(*pUnitNode);18754 pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);1875518756 if(pLoopUnit)18757 {18758 // Give movement to great general?18759 if(pLoopUnit->IsGreatGeneralReceivesMovement())18760 {18761 // Same domain18762 if(pLoopUnit->getDomainType() == getDomainType())18763 {18764#if defined(MOD_PROMOTIONS_FLAGSHIP)18765 iRtnValue = std::max(iRtnValue, pLoopUnit->maxMoves());18766#else18767 iRtnValue = pLoopUnit->maxMoves();18768#endif18769 break;18770 }18771 }18772 }18773 }18774 }18775 }1877618777 return iRtnValue;18778}