CvUnit::PlotValid(CvPlot *, byte) const
- Defined in
- CvUnit.cpp, line 24060
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_PlotValid
Hooks
static bool BeforeCvUnit_PlotValid(const CvUnit* self, CvPlot* pPlot, byte bMoveFlags, bool& result);static void AfterCvUnit_PlotValid(const CvUnit* self, CvPlot* pPlot, byte bMoveFlags, bool& result);static bool ReplaceCvUnit_PlotValid(bool (*original)(const CvUnit*, CvPlot*, byte), const CvUnit* self, CvPlot* pPlot, byte bMoveFlags);CivRegisterBefore<CivHooks::CvUnit_PlotValid>(host, &BeforeCvUnit_PlotValid);CivRegisterAfter<CivHooks::CvUnit_PlotValid>(host, &AfterCvUnit_PlotValid);CivRegisterReplace<CivHooks::CvUnit_PlotValid>(host, &ReplaceCvUnit_PlotValid);
Code
24059#if defined(MOD_AI_SECONDARY_WORKERS)24060bool CvUnit::PlotValid(CvPlot* pPlot, byte bMoveFlags) const24061#else24062bool CvUnit::PlotValid(CvPlot* pPlot) const24063#endif24064{24065 VALIDATE_OBJECT24066 if(isNoRevealMap() && willRevealByMove(*pPlot))24067 {24068 return false;24069 }2407024071#if defined(MOD_AI_SECONDARY_WORKERS)24072 if(!canEnterTerrain(*pPlot, bMoveFlags))24073#else24074 if(!canEnterTerrain(*pPlot))24075#endif24076 {24077 return false;24078 }2407924080 switch(getDomainType())24081 {24082 case DOMAIN_SEA:24083 if(pPlot->isWater() || canMoveAllTerrain())24084 {24085 return true;24086 }24087#if defined(MOD_GLOBAL_PASSABLE_FORTS)24088 else24089 {24090 bool bCanEnter = pPlot->isFriendlyCityOrPassableImprovement(*this, true) && (MOD_GLOBAL_PASSABLE_FORTS_ANY || pPlot->isCoastalLand() || plot()->isLake());24091 if(bCanEnter)24092 {24093 return true;24094 }24095 }24096#else24097 else if(pPlot->isFriendlyCity(*this, true) && pPlot->isCoastalLand())24098 {24099 return true;24100 }24101#endif24102 break;2410324104 case DOMAIN_AIR:24105 CvAssert(false);24106 break;2410724108 case DOMAIN_LAND:24109#if defined(MOD_BUGFIX_HOVERING_PATHFINDER)24110#if defined(MOD_AI_SECONDARY_WORKERS)24111 if((pPlot->getArea() == getArea() || (bMoveFlags&MOVEFLAG_PRETEND_CORRECT_EMBARK_STATE)) || canMoveAllTerrain() || IsHoveringUnit() || pPlot->IsAllowsWalkWater())24112#else24113 if(pPlot->getArea() == getArea() || canMoveAllTerrain() || IsHoveringUnit() || pPlot->IsAllowsWalkWater())24114#endif24115#else24116#if defined(MOD_AI_SECONDARY_WORKERS)24117 if((pPlot->getArea() == getArea() || (bMoveFlags&MOVEFLAG_PRETEND_CORRECT_EMBARK_STATE)) || canMoveAllTerrain() || pPlot->IsAllowsWalkWater())24118#else24119 if(pPlot->getArea() == getArea() || canMoveAllTerrain() || pPlot->IsAllowsWalkWater())24120#endif24121#endif24122 {24123 return true;24124 }24125 24126#if defined(MOD_PATHFINDER_CROSS_ICE)24127 if (canCrossIce() && pPlot->isIce()) {24128 return true;24129 }24130#endif24131 break;2413224133 case DOMAIN_IMMOBILE:24134 CvAssert(false);24135 break;2413624137 default:24138 CvAssert(false);24139 break;24140 }2414124142 return false;24143}
Calls
- CustomMods::isGLOBAL_PASSABLE_FORTS()
- CustomMods::isGLOBAL_PASSABLE_FORTS_ANY()
- CvPlot::getArea() const
- CvPlot::IsAllowsWalkWater() const
- CvPlot::isCoastalLand(int) const
- CvPlot::isFriendlyCityOrPassableImprovement(const CvUnit &, bool) const
- CvPlot::isIce() const
- CvPlot::isLake() const
- CvPlot::isWater() const
- CvUnit::canCrossIce() const
- CvUnit::canEnterTerrain(const CvPlot &, byte) const
- CvUnit::canMoveAllTerrain() const
- CvUnit::getArea() const
- CvUnit::getDomainType() const
- CvUnit::IsHoveringUnit() const
- CvUnit::isNoRevealMap() const
- CvUnit::plot() const
- CvUnit::willRevealByMove(const CvPlot &) const