Compare commits
3 Commits
1604b150d4
...
62d527737a
Author | SHA1 | Date | |
---|---|---|---|
62d527737a | |||
25069630a7 | |||
cb2510a2a1 |
@ -52,8 +52,6 @@ namespace astar
|
||||
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)
|
||||
meetingEnds = ExploreSide(true, graph, toVisitStart, rl, priorityHelper, closestEndNode, car, DefaultPriorityWeights, pathing, logger);
|
||||
|
||||
ulong closestStartNodeId = toVisitStart.UnorderedItems
|
||||
.MinBy(n => graph.Nodes[n.Element].DistanceTo(endNode.Value)).Element;
|
||||
@ -63,8 +61,6 @@ namespace astar
|
||||
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)
|
||||
meetingEnds = ExploreSide(false, graph, toVisitEnd, rl, priorityHelper, closestStartNode, car, DefaultPriorityWeights, pathing, logger);
|
||||
|
||||
if (meetingEnds is not null)
|
||||
break;
|
||||
@ -88,7 +84,7 @@ namespace astar
|
||||
return PathFound(graph, meetingEnds!.Value.Item1, meetingEnds.Value.Item2, car, logger);
|
||||
}
|
||||
|
||||
private static ValueTuple<Node, Node>? ExploreSide(bool fromStart, Graph graph, PriorityQueue<ulong, int> toVisit, RegionLoader rl, PriorityHelper priorityHelper, Node goalNode, bool car, ValueTuple<float,float,float,float> ratingWeights, PathMeasure pathing = PathMeasure.Distance, ILogger? logger = null)
|
||||
private static ValueTuple<Node, Node>? ExploreSide(bool fromStart, Graph graph, PriorityQueue<ulong, int> toVisit, RegionLoader rl, PriorityHelper priorityHelper, Node goalNode, bool car, ValueTuple<float,float,float,float> ratingWeights, PathMeasure pathing, ILogger? logger = null)
|
||||
{
|
||||
ulong currentNodeId = toVisit.Dequeue();
|
||||
Node currentNode = graph.Nodes[currentNodeId];
|
||||
@ -99,6 +95,7 @@ namespace astar
|
||||
graph.ConcatGraph(Graph.FromGraph(rl.LoadRegionFromNodeId(neighborId)));
|
||||
if (!graph.ContainsWay(wayId.Key))
|
||||
{
|
||||
logger?.LogDebug("Loading way... This will be slow.");
|
||||
foreach (global::Graph.Graph? g in rl.LoadRegionsFromWayId(wayId.Key))
|
||||
graph.ConcatGraph(Graph.FromGraph(g));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user