1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

AI pathfinding: bug fix after refactoring

This commit is contained in:
Andrii Danylchenko 2018-10-09 22:30:12 +03:00 committed by Alexander Shishkin
parent 83aae7d72b
commit cbaa834589
2 changed files with 8 additions and 6 deletions

View File

@ -282,12 +282,12 @@ void CPathfinder::calculatePaths()
if(!hlp->isLayerAvailable(neighbour->layer))
continue;
/// Check transition without tile accessability rules
if(source.node->layer != neighbour->layer && !isLayerTransitionPossible(neighbour->layer))
continue;
destination.setNode(gs, neighbour);
/// Check transition without tile accessability rules
if(source.node->layer != neighbour->layer && !isLayerTransitionPossible())
continue;
destination.turn = turn;
destination.movementLeft = movement;
@ -428,8 +428,10 @@ bool CPathfinder::isPatrolMovementAllowed(const int3 & dst) const
return true;
}
bool CPathfinder::isLayerTransitionPossible(const ELayer destLayer) const
bool CPathfinder::isLayerTransitionPossible() const
{
ELayer destLayer = destination.node->layer;
/// No layer transition allowed when previous node action is BATTLE
if(source.node->action == CGPathNode::BATTLE)
return false;

View File

@ -390,7 +390,7 @@ private:
bool isHeroPatrolLocked() const;
bool isPatrolMovementAllowed(const int3 & dst) const;
bool isLayerTransitionPossible(const ELayer dstLayer) const;
bool isLayerTransitionPossible() const;
CGPathNode::ENodeAction getTeleportDestAction() const;
bool isSourceInitialPosition() const;