1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-21 21:17:49 +02:00

CPathfinder: always add air and water layer nodes to queue

It's should be possible to go into air layer from visitable object (but opposite isn't allowed).
And when walking on water player can't really interact with any object at all so future movement always possible.
This commit is contained in:
ArseniyShestakov 2015-11-04 11:53:52 +03:00
parent 595deda270
commit 934c682733

View File

@ -265,6 +265,10 @@ bool CPathfinder::isMovementToDestPossible()
bool CPathfinder::isMovementAfterDestPossible() bool CPathfinder::isMovementAfterDestPossible()
{ {
switch (dp->layer)
{
case EPathfindingLayer::LAND:
case EPathfindingLayer::SAIL:
if(dp->accessible == CGPathNode::ACCESSIBLE) if(dp->accessible == CGPathNode::ACCESSIBLE)
return true; return true;
if(dp->coord == CGHeroInstance::convertPosition(hero->pos, false)) if(dp->coord == CGHeroInstance::convertPosition(hero->pos, false))
@ -275,6 +279,14 @@ bool CPathfinder::isMovementAfterDestPossible()
return true; return true;
if(isDestinationGuarded() && !isSourceGuarded()) if(isDestinationGuarded() && !isSourceGuarded())
return true; // Can step into a hostile tile once return true; // Can step into a hostile tile once
break;
case EPathfindingLayer::AIR:
case EPathfindingLayer::WATER:
return true;
break;
}
return false; return false;
} }