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;
|
useTeleportOneWay = true;
|
||||||
useTeleportOneWayRandom = false;
|
useTeleportOneWayRandom = false;
|
||||||
useTeleportWhirlpool = 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)
|
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;
|
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)
|
else if(cp->layer == EPathfindingLayer::SAIL && dp->layer != EPathfindingLayer::LAND)
|
||||||
return false;
|
return false;
|
||||||
else if(cp->layer == EPathfindingLayer::SAIL && dp->layer == EPathfindingLayer::LAND)
|
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 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)
|
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();
|
PathfinderOptions();
|
||||||
} options;
|
} options;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user