CvUnit::getAirliftFromPlot(const CvPlot *) const
- Defined in
- CvUnit.cpp, line 6120
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_getAirliftFromPlot- Lua events
GameEvents.CanAirliftFrom
Hooks
static bool BeforeCvUnit_getAirliftFromPlot(const CvUnit* self, const CvPlot* pPlot, const CvPlot*& result);static void AfterCvUnit_getAirliftFromPlot(const CvUnit* self, const CvPlot* pPlot, const CvPlot*& result);static const CvPlot* ReplaceCvUnit_getAirliftFromPlot(const CvPlot* (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_getAirliftFromPlot>(host, &BeforeCvUnit_getAirliftFromPlot);CivRegisterAfter<CivHooks::CvUnit_getAirliftFromPlot>(host, &AfterCvUnit_getAirliftFromPlot);CivRegisterReplace<CivHooks::CvUnit_getAirliftFromPlot>(host, &ReplaceCvUnit_getAirliftFromPlot);
Code
6120const CvPlot* CvUnit::getAirliftFromPlot(const CvPlot* pPlot) const6121#endif6122{6123 VALIDATE_OBJECT6124 CvCity* pCity;61256126#if defined(MOD_GLOBAL_RELOCATION)6127 // Early out if we're a trade unit6128 if (isTrade())6129 {6130 return NULL;6131 }6132#endif61336134#if defined(MOD_EVENTS_AIRLIFT)6135 if (MOD_EVENTS_AIRLIFT) {6136 if (GAMEEVENTINVOKE_TESTANY(GAMEEVENT_CanAirliftFrom, getOwner(), GetID(), pPlot->getX(), pPlot->getY()) == GAMEEVENTRETURN_TRUE) {6137 return pPlot;6138 }6139 }6140#endif61416142 if(getDomainType() != DOMAIN_LAND)6143 {6144#if defined(MOD_GLOBAL_RELOCATION)6145 return NULL;6146#else6147 return false;6148#endif6149 }61506151 if(hasMoved())6152 {6153#if defined(MOD_GLOBAL_RELOCATION)6154 return NULL;6155#else6156 return false;6157#endif6158 }61596160#if defined(MOD_GLOBAL_RELOCATION)6161 // Are we stood on a friendly improvement that AllowsAirliftFrom6162 ImprovementTypes eImprovement = pPlot->getImprovementType();6163 if (eImprovement != NO_IMPROVEMENT)6164 {6165 CvImprovementEntry *pkEntry = GC.getImprovementInfo(eImprovement);6166 if (pkEntry && pkEntry->IsAllowsAirliftFrom() && !pPlot->IsImprovementPillaged() && pPlot->IsFriendlyTerritory(getOwner()) && !pPlot->isVisibleEnemyUnit(getOwner()))6167 {6168 return pPlot;6169 }6170 }61716172 const CvPlot* pFromPlot = pPlot;6173#endif61746175 if (pPlot->isWater())6176 {6177#if defined(MOD_GLOBAL_RELOCATION)6178 return NULL;6179#else6180 return false;6181#endif6182 }61836184 pCity = pPlot->getPlotCity();6185 if(pCity == NULL)6186 {6187 pCity = pPlot->GetAdjacentCity();6188 if (pCity == NULL)6189 {6190#if defined(MOD_GLOBAL_RELOCATION)6191 return NULL;6192#else6193 return false;6194#endif6195 }6196#if defined(MOD_GLOBAL_RELOCATION)6197 else6198 {6199 pFromPlot = pCity->plot();6200 }6201#endif6202 }62036204#if defined(MOD_GLOBAL_RELOCATION)6205 // First thing checked for above6206#else6207 if (isTrade())6208 {6209 return false;6210 }6211#endif62126213#if defined(MOD_GLOBAL_RELOCATION)6214 if(pCity->getTeam() != getTeam())6215 {6216 return NULL;6217 }6218#endif62196220 if (!pCity->CanAirlift())6221 {6222#if defined(MOD_GLOBAL_RELOCATION)6223 return NULL;6224#else6225 return false;6226#endif6227 }62286229#if defined(MOD_GLOBAL_RELOCATION)6230 // Moved earlier on6231#else6232 if(pCity->getTeam() != getTeam())6233 {6234 return false;6235 }6236#endif62376238#if defined(MOD_GLOBAL_RELOCATION)6239 return pFromPlot;6240#else6241 return true;6242#endif6243}
Calls
- CustomMods::eventTestAny(const char *, const char *, ...)
- CustomMods::isEVENTS_AIRLIFT()
- CvCity::CanAirlift() const
- CvCity::getTeam() const
- CvCity::plot() const
- CvGlobals::getImprovementInfo(ImprovementTypes)
- CvImprovementEntry::IsAllowsAirliftFrom() 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
- CvPlot::isWater() const
- CvUnit::getDomainType() const
- CvUnit::GetID() const
- CvUnit::getOwner() const
- CvUnit::getTeam() const
- CvUnit::hasMoved() const
- CvUnit::isTrade() const