CvUnit::canDisembarkOnto(const CvPlot &, bool) const
- Defined in
- CvUnit.cpp, line 5092
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_canDisembarkOnto_with_const_CvPlot_bool_const
Hooks
static bool BeforeCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const(const CvUnit* self, const CvPlot& targetPlot, bool bIsDestination, bool& result);static void AfterCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const(const CvUnit* self, const CvPlot& targetPlot, bool bIsDestination, bool& result);static bool ReplaceCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const(bool (*original)(const CvUnit*, const CvPlot&, bool), const CvUnit* self, const CvPlot& targetPlot, bool bIsDestination);CivRegisterBefore<CivHooks::CvUnit_canDisembarkOnto_with_const_CvPlot_bool_const>(host, &BeforeCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const);CivRegisterAfter<CivHooks::CvUnit_canDisembarkOnto_with_const_CvPlot_bool_const>(host, &AfterCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const);CivRegisterReplace<CivHooks::CvUnit_canDisembarkOnto_with_const_CvPlot_bool_const>(host, &ReplaceCvUnit_canDisembarkOnto_with_const_CvPlot_bool_const);
Code
5092bool CvUnit::canDisembarkOnto(const CvPlot& targetPlot, bool bIsDestination /* = false */) const5093{5094 VALIDATE_OBJECT5095 if(getDomainType() != DOMAIN_LAND)5096 {5097 return false;5098 }50995100 if(!isEmbarked())5101 {5102 return false;5103 }51045105 if(!plot()->isWater())5106 {5107 return false;5108 }51095110#if defined(MOD_PATHFINDER_TERRAFIRMA)5111 // Can we disembark onto targetPlot from our current plot?5112 // Only if we are adjacent to land (actual check for plot being land/ice is below)5113 bool bCanDisembark = plot()->isAdjacentToLand();5114#if defined(MOD_PATHFINDER_CROSS_ICE)5115 // ... or we cross ice and the target plot is ice5116 bCanDisembark = bCanDisembark || (canCrossIce() && targetPlot.isIce());5117#endif5118#if defined(MOD_PATHFINDER_DEEP_WATER_EMBARKATION)5119 // ... or we hover and the target plot is shallow water5120 bCanDisembark = bCanDisembark || (IsHoveringUnit() && targetPlot.isShallowWater());5121#endif5122 if(!bCanDisembark)5123#else5124 if(!plot()->isAdjacentToLand())5125#endif5126 {5127 return false;5128 }51295130 if(!targetPlot.isRevealed(getTeam()))5131 {5132 return false;5133 }51345135 return canMoveInto(targetPlot, MOVEFLAG_PRETEND_UNEMBARKED | ((bIsDestination)?MOVEFLAG_DESTINATION:0));5136}
Calls
- CvPlot::isAdjacentToLand() const
- CvPlot::isIce() const
- CvPlot::isRevealed(TeamTypes) const
- CvPlot::isShallowWater() 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
- CvUnit::plot() const