CvUnit::lead(int)
- Defined in
- CvUnit.cpp, line 10770
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_lead
Hooks
static bool BeforeCvUnit_lead(CvUnit* self, int iUnitId, bool& result);static void AfterCvUnit_lead(CvUnit* self, int iUnitId, bool& result);static bool ReplaceCvUnit_lead(bool (*original)(CvUnit*, int), CvUnit* self, int iUnitId);CivRegisterBefore<CivHooks::CvUnit_lead>(host, &BeforeCvUnit_lead);CivRegisterAfter<CivHooks::CvUnit_lead>(host, &AfterCvUnit_lead);CivRegisterReplace<CivHooks::CvUnit_lead>(host, &ReplaceCvUnit_lead);
Code
10770bool CvUnit::lead(int iUnitId)10771{10772 VALIDATE_OBJECT10773 if(!canLead(plot(), iUnitId))10774 {10775 return false;10776 }1077710778 PromotionTypes eLeaderPromotion = (PromotionTypes)m_pUnitInfo->GetLeaderPromotion();1077910780 if(-1 == iUnitId)10781 {10782 return false;10783 }10784 else10785 {10786 UnitHandle pUnit = GET_PLAYER(getOwner()).getUnit(iUnitId);1078710788 if(!pUnit || !pUnit->canPromote(eLeaderPromotion, GetID()))10789 {10790 return false;10791 }1079210793 pUnit->promote(eLeaderPromotion, GetID());1079410795 kill(true);1079610797 return true;10798 }10799}
Calls
- CvPlayer::getUnit(int)
- CvPlayerAI::getPlayer(PlayerTypes)
- CvUnit::canLead(const CvPlot *, int) const
- CvUnit::canPromote(PromotionTypes, int) const
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::kill(bool, PlayerTypes)
- CvUnit::plot() const
- CvUnit::promote(PromotionTypes, int)
- CvUnitEntry::GetLeaderPromotion() const
FObjectHandle::FObjectHandleFObjectHandle::operator!FObjectHandle::operator->