CvPlot::addUnit(CvUnit *, bool)
- Defined in
- CvPlot.cpp, line 10287
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_addUnit
Hooks
static bool BeforeCvPlot_addUnit(CvPlot* self, CvUnit* pUnit, bool bUpdate);static void AfterCvPlot_addUnit(CvPlot* self, CvUnit* pUnit, bool bUpdate);static void ReplaceCvPlot_addUnit(void (*original)(CvPlot*, CvUnit*, bool), CvPlot* self, CvUnit* pUnit, bool bUpdate);CivRegisterBefore<CivHooks::CvPlot_addUnit>(host, &BeforeCvPlot_addUnit);CivRegisterAfter<CivHooks::CvPlot_addUnit>(host, &AfterCvPlot_addUnit);CivRegisterReplace<CivHooks::CvPlot_addUnit>(host, &ReplaceCvPlot_addUnit);
Code
10287void CvPlot::addUnit(CvUnit* pUnit, bool bUpdate)10288{10289 CvAssertMsg(pUnit, "pUnit is expected to be non-NULL");10290 if(pUnit == NULL)10291 return;1029210293 CvAssertMsg(pUnit->at(getX(), getY()), "pUnit is expected to be at getX_INLINE and getY_INLINE");1029410295 IDInfo* pUnitNode = headUnitNode();10296 while(pUnitNode != NULL)10297 {10298 CvUnit* pLoopUnit = GetPlayerUnit(*pUnitNode);10299 if(!isBeforeUnitCycle(pLoopUnit, pUnit))10300 {10301 break;10302 }1030310304 pUnitNode = nextUnitNode(pUnitNode);10305 }1030610307 if(pUnitNode != NULL)10308 {10309 IDInfo unitIDInfo = pUnit->GetIDInfo();10310 m_units.insertBefore(&unitIDInfo, pUnitNode);10311 }10312 else10313 {10314 IDInfo unitIDInfo = pUnit->GetIDInfo();10315 m_units.insertAtEnd(&unitIDInfo);10316 }1031710318 if(bUpdate)10319 {10320 updateCenterUnit();10321 }10322}
Calls
- CvPlot::headUnitNode()
- CvPlot::nextUnitNode(IDInfo *)
- CvPlot::updateCenterUnit()
- CvUnit::GetIDInfo() const
FFastSmallFixedList::insertAtEndFFastSmallFixedList::insertBefore- GetPlayerUnit(IDInfo &)
- isBeforeUnitCycle(const CvUnit *, const CvUnit *)