Simplify check
This commit is contained in:
parent
c4a9567f7d
commit
8a063f07d8
@ -94,8 +94,7 @@ namespace astar
|
|||||||
|
|
||||||
Node neighborNode = graph.Nodes[neighborId];
|
Node neighborNode = graph.Nodes[neighborId];
|
||||||
|
|
||||||
if (neighborNode.PreviousIsFromStart is not null &&
|
if (neighborNode.PreviousIsFromStart == !fromStart) //Check if we found the opposite End
|
||||||
neighborNode.PreviousIsFromStart != fromStart) //Check if we found the opposite End
|
|
||||||
return fromStart ? new(currentNode, neighborNode) : new(neighborNode, currentNode);
|
return fromStart ? new(currentNode, neighborNode) : new(neighborNode, currentNode);
|
||||||
|
|
||||||
float metric = (currentNode.Metric ?? float.MaxValue) + (pathing is PathMeasure.Distance
|
float metric = (currentNode.Metric ?? float.MaxValue) + (pathing is PathMeasure.Distance
|
||||||
@ -109,7 +108,6 @@ namespace astar
|
|||||||
toVisit.Enqueue(neighborId,
|
toVisit.Enqueue(neighborId,
|
||||||
priorityHelper.CalculatePriority(currentNode, neighborNode, goalNode, speed, ratingWeights));
|
priorityHelper.CalculatePriority(currentNode, neighborNode, goalNode, speed, ratingWeights));
|
||||||
}
|
}
|
||||||
logger?.LogTrace($"Neighbor {neighborId} {neighborNode}");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
Reference in New Issue
Block a user