CvUnit::setHotKeyNumber(int)
- Defined in
- CvUnit.cpp, line 15521
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_setHotKeyNumber
Hooks
static bool BeforeCvUnit_setHotKeyNumber(CvUnit* self, int iNewValue);static void AfterCvUnit_setHotKeyNumber(CvUnit* self, int iNewValue);static void ReplaceCvUnit_setHotKeyNumber(void (*original)(CvUnit*, int), CvUnit* self, int iNewValue);CivRegisterBefore<CivHooks::CvUnit_setHotKeyNumber>(host, &BeforeCvUnit_setHotKeyNumber);CivRegisterAfter<CivHooks::CvUnit_setHotKeyNumber>(host, &AfterCvUnit_setHotKeyNumber);CivRegisterReplace<CivHooks::CvUnit_setHotKeyNumber>(host, &ReplaceCvUnit_setHotKeyNumber);
Code
15521void CvUnit::setHotKeyNumber(int iNewValue)15522{15523 VALIDATE_OBJECT15524 CvUnit* pLoopUnit;15525 int iLoop;1552615527 CvAssert(getOwner() != NO_PLAYER);1552815529 if(getHotKeyNumber() != iNewValue)15530 {15531 if(iNewValue != -1)15532 {15533 for(pLoopUnit = GET_PLAYER(getOwner()).firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = GET_PLAYER(getOwner()).nextUnit(&iLoop))15534 {15535 if(pLoopUnit->getHotKeyNumber() == iNewValue)15536 {15537 pLoopUnit->setHotKeyNumber(-1);15538 }15539 }15540 }1554115542 m_iHotKeyNumber = iNewValue;15543 }15544}