CvUnit::getAirliftToPlot(const CvPlot *, bool) const
- Defined in
- CvUnit.cpp, line 6074
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_getAirliftToPlot- Lua events
GameEvents.CanAirliftTo
Hooks
static bool BeforeCvUnit_getAirliftToPlot(const CvUnit* self, const CvPlot* pPlot, bool bIncludeCities, const CvPlot*& result);static void AfterCvUnit_getAirliftToPlot(const CvUnit* self, const CvPlot* pPlot, bool bIncludeCities, const CvPlot*& result);static const CvPlot* ReplaceCvUnit_getAirliftToPlot(const CvPlot* (*original)(const CvUnit*, const CvPlot*, bool), const CvUnit* self, const CvPlot* pPlot, bool bIncludeCities);CivRegisterBefore<CivHooks::CvUnit_getAirliftToPlot>(host, &BeforeCvUnit_getAirliftToPlot);CivRegisterAfter<CivHooks::CvUnit_getAirliftToPlot>(host, &AfterCvUnit_getAirliftToPlot);CivRegisterReplace<CivHooks::CvUnit_getAirliftToPlot>(host, &ReplaceCvUnit_getAirliftToPlot);
Code
6074const CvPlot* CvUnit::getAirliftToPlot(const CvPlot* pPlot, bool bIncludeCities) const6075{60766077#if defined(MOD_EVENTS_AIRLIFT)6078 if (MOD_EVENTS_AIRLIFT) {6079 if (GAMEEVENTINVOKE_TESTANY(GAMEEVENT_CanAirliftTo, getOwner(), GetID(), pPlot->getX(), pPlot->getY()) == GAMEEVENTRETURN_TRUE) {6080 return pPlot;6081 }6082 }6083#endif60846085 // Is there a friendly improvement that AllowsAirliftTo6086 ImprovementTypes eImprovement = pPlot->getImprovementType();6087 if (eImprovement != NO_IMPROVEMENT)6088 {6089 CvImprovementEntry *pkEntry = GC.getImprovementInfo(eImprovement);6090 if (pkEntry && pkEntry->IsAllowsAirliftTo() && !pPlot->IsImprovementPillaged() && pPlot->IsFriendlyTerritory(getOwner()) && !pPlot->isVisibleEnemyUnit(getOwner()))6091 {6092 return pPlot;6093 }6094 }60956096#if defined(MOD_EVENTS_AIRLIFT)6097 if (!bIncludeCities) {6098 return NULL;6099 }6100#endif61016102 CvCity* pEndCity = pPlot->getPlotCity();6103 if (pEndCity == NULL)6104 {6105 pEndCity = pPlot->GetAdjacentCity();6106 if (pEndCity == NULL)6107 {6108 return NULL;6109 }6110 }61116112 if (!pEndCity->CanAirlift())6113 {6114 return NULL;6115 }61166117 return pPlot;6118}
Calls
- CustomMods::eventTestAny(const char *, const char *, ...)
- CustomMods::isEVENTS_AIRLIFT()
- CvCity::CanAirlift() const
- CvGlobals::getImprovementInfo(ImprovementTypes)
- CvImprovementEntry::IsAllowsAirliftTo() const
- CvPlot::GetAdjacentCity(bool) const
- CvPlot::getImprovementType() const
- CvPlot::getPlotCity() const
- CvPlot::getX() const
- CvPlot::getY() const
- CvPlot::IsFriendlyTerritory(PlayerTypes) const
- CvPlot::IsImprovementPillaged() const
- CvPlot::isVisibleEnemyUnit(PlayerTypes) const
- CvUnit::GetID() const
- CvUnit::getOwner() const