CvPlot::removeUnit(CvUnit *, bool)
- Defined in
- CvPlot.cpp, line 10326
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_removeUnit
Hooks
static bool BeforeCvPlot_removeUnit(CvPlot* self, CvUnit* pUnit, bool bUpdate);static void AfterCvPlot_removeUnit(CvPlot* self, CvUnit* pUnit, bool bUpdate);static void ReplaceCvPlot_removeUnit(void (*original)(CvPlot*, CvUnit*, bool), CvPlot* self, CvUnit* pUnit, bool bUpdate);CivRegisterBefore<CivHooks::CvPlot_removeUnit>(host, &BeforeCvPlot_removeUnit);CivRegisterAfter<CivHooks::CvPlot_removeUnit>(host, &AfterCvPlot_removeUnit);CivRegisterReplace<CivHooks::CvPlot_removeUnit>(host, &ReplaceCvPlot_removeUnit);
Code
10326void CvPlot::removeUnit(CvUnit* pUnit, bool bUpdate)10327{10328 IDInfo* pUnitNode;1032910330 pUnitNode = headUnitNode();1033110332 while(pUnitNode != NULL)10333 {10334 if(GetPlayerUnit(*pUnitNode) == pUnit)10335 {10336 CvAssertMsg(GetPlayerUnit(*pUnitNode)->at(getX(), getY()), "The current unit instance is expected to be at getX_INLINE and getY_INLINE");10337 m_units.deleteNode(pUnitNode);10338 break;10339 }10340 else10341 {10342 pUnitNode = nextUnitNode(pUnitNode);10343 }10344 }1034510346 GC.getMap().plotManager().RemoveUnit(pUnit->GetIDInfo(), m_iX, m_iY, -1);1034710348 if(bUpdate)10349 {10350 updateCenterUnit();10351 }10352}