From 271d84f13f82cf6d94c3f22cb2fb9c112fa10f89 Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 25 Jul 2024 02:22:08 +0200 Subject: [PATCH] Dequeue either half the queue or max 50 from priority. --- astar/Astar.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astar/Astar.cs b/astar/Astar.cs index 00113c1..739e9fe 100644 --- a/astar/Astar.cs +++ b/astar/Astar.cs @@ -49,7 +49,7 @@ namespace astar Node closestEndNode = graph.Nodes[closestEndNodeId]; if (toVisitStart.Count >= toVisitEnd.Count && meetingEnds is null) { - for(int i = 0; i < toVisitStart.Count / 10 && meetingEnds is null; i++) + for(int i = 0; i < Math.Min(toVisitStart.Count * 0.5, 50) && meetingEnds is null; i++) meetingEnds = ExploreSide(true, graph, toVisitStart, rl, priorityHelper, closestEndNode, car, DefaultPriorityWeights, pathing, logger); } if(meetingEnds is null) @@ -60,7 +60,7 @@ namespace astar Node closestStartNode = graph.Nodes[closestStartNodeId]; if (toVisitEnd.Count >= toVisitStart.Count && meetingEnds is null) { - for(int i = 0; i < toVisitEnd.Count / 10 && meetingEnds is null; i++) + for(int i = 0; i < Math.Min(toVisitEnd.Count * 0.5, 50) && meetingEnds is null; i++) meetingEnds = ExploreSide(false, graph, toVisitEnd, rl, priorityHelper, closestStartNode, car, DefaultPriorityWeights, pathing, logger); } if(meetingEnds is null)