From 0a3cfea0172be6135451653149d2b4e7aa40d53b Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 23 May 2024 18:47:13 +0000 Subject: [PATCH] Simplify code --- lib/pathfinder/PathfindingRules.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pathfinder/PathfindingRules.cpp b/lib/pathfinder/PathfindingRules.cpp index c95c83875..fa6531c28 100644 --- a/lib/pathfinder/PathfindingRules.cpp +++ b/lib/pathfinder/PathfindingRules.cpp @@ -342,11 +342,11 @@ PathfinderBlockingRule::BlockingReason MovementToDestinationRule::getBlockingRea break; case EPathfindingLayer::WATER: - if(!pathfinderHelper->canMoveBetween(source.coord, destination.coord) - || destination.node->accessible != EPathAccessibility::ACCESSIBLE) - { + if(!pathfinderHelper->canMoveBetween(source.coord, destination.coord)) + return BlockingReason::DESTINATION_BLOCKED; + + if (destination.node->accessible != EPathAccessibility::ACCESSIBLE) return BlockingReason::DESTINATION_BLOCKED; - } if(destination.guarded) return BlockingReason::DESTINATION_BLOCKED;