1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Add turn limit option to pathfinder

This commit is contained in:
Ivan Savenko 2023-09-19 22:26:38 +03:00
parent 56074e18a9
commit c8a96647c3
3 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,8 @@ void CPathfinder::calculatePaths()
movement = hlp->getMaxMovePoints(source.node->layer); movement = hlp->getMaxMovePoints(source.node->layer);
if(!hlp->passOneTurnLimitCheck(source)) if(!hlp->passOneTurnLimitCheck(source))
continue; continue;
if(turn >= hlp->options.turnLimit)
continue;
} }
source.isInitialPosition = source.nodeHero == hlp->hero; source.isInitialPosition = source.nodeHero == hlp->hero;

View File

@ -30,6 +30,7 @@ PathfinderOptions::PathfinderOptions()
, lightweightFlyingMode(false) , lightweightFlyingMode(false)
, oneTurnSpecialLayersLimit(true) , oneTurnSpecialLayersLimit(true)
, originalMovementRules(false) , originalMovementRules(false)
, turnLimit(std::numeric_limits<uint8_t>::max())
{ {
} }

View File

@ -68,6 +68,9 @@ struct DLL_LINKAGE PathfinderOptions
/// I find it's reasonable limitation, but it's will make some movements more expensive than in H3. /// I find it's reasonable limitation, but it's will make some movements more expensive than in H3.
bool originalMovementRules; bool originalMovementRules;
/// Max number of turns to compute. Default = infinite
uint8_t turnLimit;
PathfinderOptions(); PathfinderOptions();
}; };