CvUnit::canDisembarkOnto(const CvPlot &, const CvPlot &, bool, bool) const
- Defined in
- CvUnit.cpp, line 5043
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_canDisembarkOnto
Hooks
static bool BeforeCvUnit_canDisembarkOnto(const CvUnit* self, const CvPlot& originPlot, const CvPlot& targetPlot, bool bOverrideEmbarkedCheck, bool bIsDestination, bool& result);static void AfterCvUnit_canDisembarkOnto(const CvUnit* self, const CvPlot& originPlot, const CvPlot& targetPlot, bool bOverrideEmbarkedCheck, bool bIsDestination, bool& result);static bool ReplaceCvUnit_canDisembarkOnto(bool (*original)(const CvUnit*, const CvPlot&, const CvPlot&, bool, bool), const CvUnit* self, const CvPlot& originPlot, const CvPlot& targetPlot, bool bOverrideEmbarkedCheck, bool bIsDestination);CivRegisterBefore<CivHooks::CvUnit_canDisembarkOnto>(host, &BeforeCvUnit_canDisembarkOnto);CivRegisterAfter<CivHooks::CvUnit_canDisembarkOnto>(host, &AfterCvUnit_canDisembarkOnto);CivRegisterReplace<CivHooks::CvUnit_canDisembarkOnto>(host, &ReplaceCvUnit_canDisembarkOnto);
Code
5043bool CvUnit::canDisembarkOnto(const CvPlot& originPlot, const CvPlot& targetPlot, bool bOverrideEmbarkedCheck /* = false */, bool bIsDestination /* = false */) const5044{5045 // This version is useful if the unit is not actually next to the plot yet -KS50465047 VALIDATE_OBJECT5048 if(getDomainType() != DOMAIN_LAND)5049 {5050 return false;5051 }50525053 if(!isEmbarked() && !bOverrideEmbarkedCheck)5054 {5055 return false;5056 }50575058 if(!originPlot.isWater())5059 {5060 return false;5061 }50625063#if defined(MOD_PATHFINDER_TERRAFIRMA)5064 // Can we disembark from originPlot to targetPlot?5065 // Only if originPlot is adjacent to land (the check for targetPlot being valid is at the end)5066 bool bCanDisembark = originPlot.isAdjacentToLand();5067#if defined(MOD_PATHFINDER_CROSS_ICE)5068 // ... or the originPlot is adjacent to ice5069 bCanDisembark = bCanDisembark || (canCrossIce() && originPlot.isAdjacentToIce());5070#endif5071#if defined(MOD_PATHFINDER_DEEP_WATER_EMBARKATION)5072 // ... or the originPlot is adjacent to shallow water5073 bCanDisembark = bCanDisembark || (IsHoveringUnit() && originPlot.isAdjacentToShallowWater());5074#endif5075 if(!bCanDisembark)5076#else5077 if(!originPlot.isAdjacentToLand())5078#endif5079 {5080 return false;5081 }50825083 if(!targetPlot.isRevealed(getTeam()))5084 {5085 return false;5086 }50875088 return canMoveInto(targetPlot, MOVEFLAG_PRETEND_UNEMBARKED | ((bIsDestination)?MOVEFLAG_DESTINATION:0));5089}
Calls
- CvPlot::isAdjacentToIce() const
- CvPlot::isAdjacentToLand() const
- CvPlot::isAdjacentToShallowWater() const
- CvPlot::isRevealed(TeamTypes) const
- CvPlot::isWater() const
- CvUnit::canCrossIce() const
- CvUnit::canMoveInto(const CvPlot &, byte) const
- CvUnit::getDomainType() const
- CvUnit::getTeam() const
- CvUnit::isEmbarked() const
- CvUnit::IsHoveringUnit() const