mirror of
https://github.com/vcmi/vcmi.git
synced 2025-09-16 09:26:28 +02:00
AI pathfinding: bug fix after refactoring
This commit is contained in:
committed by
Alexander Shishkin
parent
83aae7d72b
commit
cbaa834589
@@ -282,12 +282,12 @@ void CPathfinder::calculatePaths()
|
|||||||
if(!hlp->isLayerAvailable(neighbour->layer))
|
if(!hlp->isLayerAvailable(neighbour->layer))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/// Check transition without tile accessability rules
|
|
||||||
if(source.node->layer != neighbour->layer && !isLayerTransitionPossible(neighbour->layer))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
destination.setNode(gs, neighbour);
|
destination.setNode(gs, neighbour);
|
||||||
|
|
||||||
|
/// Check transition without tile accessability rules
|
||||||
|
if(source.node->layer != neighbour->layer && !isLayerTransitionPossible())
|
||||||
|
continue;
|
||||||
|
|
||||||
destination.turn = turn;
|
destination.turn = turn;
|
||||||
destination.movementLeft = movement;
|
destination.movementLeft = movement;
|
||||||
|
|
||||||
@@ -428,8 +428,10 @@ bool CPathfinder::isPatrolMovementAllowed(const int3 & dst) const
|
|||||||
return true;
|
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
|
/// No layer transition allowed when previous node action is BATTLE
|
||||||
if(source.node->action == CGPathNode::BATTLE)
|
if(source.node->action == CGPathNode::BATTLE)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -390,7 +390,7 @@ private:
|
|||||||
bool isHeroPatrolLocked() const;
|
bool isHeroPatrolLocked() const;
|
||||||
bool isPatrolMovementAllowed(const int3 & dst) const;
|
bool isPatrolMovementAllowed(const int3 & dst) const;
|
||||||
|
|
||||||
bool isLayerTransitionPossible(const ELayer dstLayer) const;
|
bool isLayerTransitionPossible() const;
|
||||||
CGPathNode::ENodeAction getTeleportDestAction() const;
|
CGPathNode::ENodeAction getTeleportDestAction() const;
|
||||||
|
|
||||||
bool isSourceInitialPosition() const;
|
bool isSourceInitialPosition() const;
|
||||||
|
Reference in New Issue
Block a user