CvUnit::setPromotionReady(bool)
- Defined in
- CvUnit.cpp, line 19509
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_setPromotionReady- Changed in
- 0.4.0
Hand-placed hooks inside
A replacement for this function that does not call original stops these hooks from running.
Hooks
static bool BeforeCvUnit_setPromotionReady(CvUnit* self, bool bNewValue);static void AfterCvUnit_setPromotionReady(CvUnit* self, bool bNewValue);static void ReplaceCvUnit_setPromotionReady(void (*original)(CvUnit*, bool), CvUnit* self, bool bNewValue);CivRegisterBefore<CivHooks::CvUnit_setPromotionReady>(host, &BeforeCvUnit_setPromotionReady);CivRegisterAfter<CivHooks::CvUnit_setPromotionReady>(host, &AfterCvUnit_setPromotionReady);CivRegisterReplace<CivHooks::CvUnit_setPromotionReady>(host, &ReplaceCvUnit_setPromotionReady);
Code
19509void CvUnit::setPromotionReady(bool bNewValue)19510{19511 VALIDATE_OBJECT19512 if(isPromotionReady() != bNewValue)19513 {19514 m_bPromotionReady = bNewValue;1951519516 if(m_bPromotionReady)19517 {19518#if defined(CIV_HOST_API)19519 CivHandUnitOrdersCancelled(this, CIV_ORDERS_PROMOTION_READY);hand-placed hook: UnitOrdersCancelled19520#endif19521 SetAutomateType(NO_AUTOMATE);19522 ClearMissionQueue();19523 SetActivityType(ACTIVITY_AWAKE);19524 }1952519526 if(bNewValue)19527 {19528 CvNotifications* pNotifications = GET_PLAYER(getOwner()).GetNotifications();19529 if(pNotifications)19530 {19531 CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_UNIT_CAN_GET_PROMOTION");19532 CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_UNIT_CAN_GET_PROMOTION");19533 pNotifications->Add(NOTIFICATION_UNIT_PROMOTION, strBuffer, strSummary, -1, -1, getUnitType(), GetID());19534#if !defined(NO_ACHIEVEMENTS)19535 if(isHuman() && !GC.getGame().isGameMultiPlayer() && GET_PLAYER(GC.getGame().getActivePlayer()).isLocalPlayer())19536 {19537 gDLL->UnlockAchievement(ACHIEVEMENT_UNIT_PROMOTE);19538 }19539#endif19540 }19541 }1954219543 if(IsSelected())19544 {19545 DLLUI->setDirty(SelectionButtons_DIRTY_BIT, true);19546 }19547 }19548}
Calls
CivHandUnitOrdersCancelled- CvGlobals::GetEngineUserInterface()
- CvNotifications::Add(NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayer::GetNotifications() const
- CvPlayerAI::getPlayer(PlayerTypes)
CvString::operator const char *- CvUnit::ClearMissionQueue(int)
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::getUnitType() const
- CvUnit::isPromotionReady() const
- CvUnit::IsSelected() const
- CvUnit::SetActivityType(ActivityTypes, bool)
- CvUnit::SetAutomateType(AutomateTypes)
FAutoVariable::operator const bool &FAutoVariable::operator=- GetLocalizedText(const char *)
ICvUserInterface1::setDirty