From 8a063f07d846de2d8d3cd1a3c5aa396ecaa71f0f Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 29 Jul 2024 15:17:47 +0200 Subject: [PATCH] Simplify check --- astar/Astar.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/astar/Astar.cs b/astar/Astar.cs index a73360f..95b29a5 100644 --- a/astar/Astar.cs +++ b/astar/Astar.cs @@ -94,8 +94,7 @@ namespace astar Node neighborNode = graph.Nodes[neighborId]; - if (neighborNode.PreviousIsFromStart is not null && - neighborNode.PreviousIsFromStart != fromStart) //Check if we found the opposite End + if (neighborNode.PreviousIsFromStart == !fromStart) //Check if we found the opposite End return fromStart ? new(currentNode, neighborNode) : new(neighborNode, currentNode); float metric = (currentNode.Metric ?? float.MaxValue) + (pathing is PathMeasure.Distance @@ -109,7 +108,6 @@ namespace astar toVisit.Enqueue(neighborId, priorityHelper.CalculatePriority(currentNode, neighborNode, goalNode, speed, ratingWeights)); } - logger?.LogTrace($"Neighbor {neighborId} {neighborNode}"); } return null;