CvPlot::getUnitIndex(CvUnit *) const
- Defined in
- CvPlot.cpp, line 10265
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_getUnitIndex
Hooks
static bool BeforeCvPlot_getUnitIndex(const CvPlot* self, CvUnit* pUnit, int& result);static void AfterCvPlot_getUnitIndex(const CvPlot* self, CvUnit* pUnit, int& result);static int ReplaceCvPlot_getUnitIndex(int (*original)(const CvPlot*, CvUnit*), const CvPlot* self, CvUnit* pUnit);CivRegisterBefore<CivHooks::CvPlot_getUnitIndex>(host, &BeforeCvPlot_getUnitIndex);CivRegisterAfter<CivHooks::CvPlot_getUnitIndex>(host, &AfterCvPlot_getUnitIndex);CivRegisterReplace<CivHooks::CvPlot_getUnitIndex>(host, &ReplaceCvPlot_getUnitIndex);
Code
10264// Return the index of the unit in the plot's list. -1 if it is not in the list.10265int CvPlot::getUnitIndex(CvUnit* pUnit) const10266{10267 int iIndex = 0;10268 if(pUnit)10269 {10270 IDInfo kUnitInfo = pUnit->GetIDInfo();1027110272 const IDInfo* pUnitNode = headUnitNode();1027310274 while(pUnitNode != NULL)10275 {10276 if(*pUnitNode == kUnitInfo)10277 return iIndex;1027810279 ++iIndex;10280 pUnitNode = nextUnitNode(pUnitNode);10281 }10282 }10283 return -1;10284}