mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-19 21:10:12 +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:
parent
595deda270
commit
934c682733
@ -265,16 +265,28 @@ bool CPathfinder::isMovementToDestPossible()
|
||||
|
||||
bool CPathfinder::isMovementAfterDestPossible()
|
||||
{
|
||||
if(dp->accessible == CGPathNode::ACCESSIBLE)
|
||||
return true;
|
||||
if(dp->coord == CGHeroInstance::convertPosition(hero->pos, false))
|
||||
return true; // This one is tricky, we can ignore fact that tile is not ACCESSIBLE in case if it's our hero block it. Though this need investigation
|
||||
if(dp->accessible == CGPathNode::VISITABLE && CGTeleport::isTeleport(dt->topVisitableObj()))
|
||||
return true; // For now we'll always allow transit for teleporters
|
||||
if(useEmbarkCost && options.useEmbarkAndDisembark)
|
||||
return true;
|
||||
if(isDestinationGuarded() && !isSourceGuarded())
|
||||
return true; // Can step into a hostile tile once
|
||||
switch (dp->layer)
|
||||
{
|
||||
case EPathfindingLayer::LAND:
|
||||
case EPathfindingLayer::SAIL:
|
||||
if(dp->accessible == CGPathNode::ACCESSIBLE)
|
||||
return true;
|
||||
if(dp->coord == CGHeroInstance::convertPosition(hero->pos, false))
|
||||
return true; // This one is tricky, we can ignore fact that tile is not ACCESSIBLE in case if it's our hero block it. Though this need investigation
|
||||
if(dp->accessible == CGPathNode::VISITABLE && CGTeleport::isTeleport(dt->topVisitableObj()))
|
||||
return true; // For now we'll always allow transit for teleporters
|
||||
if(useEmbarkCost && options.useEmbarkAndDisembark)
|
||||
return true;
|
||||
if(isDestinationGuarded() && !isSourceGuarded())
|
||||
return true; // Can step into a hostile tile once
|
||||
break;
|
||||
|
||||
case EPathfindingLayer::AIR:
|
||||
case EPathfindingLayer::WATER:
|
||||
return true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user