mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
CPathfinder: add lightweightFlyingMode option suggested by @alexvins
This commit is contained in:
@@ -27,6 +27,8 @@ CPathfinder::PathfinderOptions::PathfinderOptions()
|
||||
useTeleportOneWay = true;
|
||||
useTeleportOneWayRandom = false;
|
||||
useTeleportWhirlpool = false;
|
||||
|
||||
lightweightFlyingMode = false;
|
||||
}
|
||||
|
||||
CPathfinder::CPathfinder(CPathsInfo &_out, CGameState *_gs, const CGHeroInstance *_hero) : CGameInfoCallback(_gs, boost::optional<PlayerColor>()), out(_out), hero(_hero), FoW(getPlayerTeam(hero->tempOwner)->fogOfWarMap)
|
||||
@@ -232,6 +234,11 @@ bool CPathfinder::isLayerTransitionPossible()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if(cp->layer == EPathfindingLayer::LAND && dp->layer == EPathfindingLayer::AIR)
|
||||
{
|
||||
if(options.lightweightFlyingMode && cp->coord != hero->getPosition(false))
|
||||
return false;
|
||||
}
|
||||
else if(cp->layer == EPathfindingLayer::SAIL && dp->layer != EPathfindingLayer::LAND)
|
||||
return false;
|
||||
else if(cp->layer == EPathfindingLayer::SAIL && dp->layer == EPathfindingLayer::LAND)
|
||||
|
@@ -85,6 +85,11 @@ private:
|
||||
bool useTeleportOneWayRandom; // One-way monoliths with more than one known exit
|
||||
bool useTeleportWhirlpool; // Force enabled if hero protected or unaffected (have one stack of one creature)
|
||||
|
||||
/// If true transition into air layer only possible from initial node.
|
||||
/// This is drastically decrease path calculation complexity (and time).
|
||||
/// Downside is less MP effective paths calculation.
|
||||
bool lightweightFlyingMode;
|
||||
|
||||
PathfinderOptions();
|
||||
} options;
|
||||
|
||||
|
Reference in New Issue
Block a user