1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fixed handling of original game rules pathfinding

This commit is contained in:
Ivan Savenko 2024-05-23 18:47:34 +00:00
parent 0a3cfea017
commit ac047d0d6d

View File

@ -278,7 +278,6 @@ PathfinderBlockingRule::BlockingReason MovementAfterDestinationRule::getBlocking
else else
return BlockingReason::DESTINATION_GUARDED; return BlockingReason::DESTINATION_GUARDED;
} }
break; break;
} }
@ -394,16 +393,22 @@ void LayerTransitionRule::process(
if(source.node->accessible != EPathAccessibility::ACCESSIBLE && if(source.node->accessible != EPathAccessibility::ACCESSIBLE &&
source.node->accessible != EPathAccessibility::VISITABLE && source.node->accessible != EPathAccessibility::VISITABLE &&
destination.node->accessible != EPathAccessibility::VISITABLE && destination.node->accessible != EPathAccessibility::VISITABLE &&
destination.node->accessible != EPathAccessibility::ACCESSIBLE) destination.node->accessible != EPathAccessibility::ACCESSIBLE)
{ {
if(destination.node->accessible == EPathAccessibility::BLOCKVIS)
if (destination.node->accessible == EPathAccessibility::BLOCKVIS)
{ {
if(source.nodeObject || (source.tile->blocked && destination.tile->blocked)) if (source.tile->blocked || !destination.tile->entrableTerrain(source.tile))
{
destination.blocked = true; destination.blocked = true;
}
} }
else
if (destination.node->accessible == EPathAccessibility::FLYABLE)
destination.blocked = true;
}
if(destination.node->accessible == EPathAccessibility::VISITABLE)
{
if (destination.node->accessible != EPathAccessibility::VISITABLE)
destination.blocked = true; destination.blocked = true;
} }
} }