From a0418a6fae0b9c5402647ebe8a4d55d514d15d65 Mon Sep 17 00:00:00 2001 From: glax Date: Mon, 22 Jul 2024 23:58:24 +0200 Subject: [PATCH] Fix neighbors not being added if they are not in the same region --- OSM_Regions/RegionLoader.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OSM_Regions/RegionLoader.cs b/OSM_Regions/RegionLoader.cs index 7d7abff..2669556 100644 --- a/OSM_Regions/RegionLoader.cs +++ b/OSM_Regions/RegionLoader.cs @@ -61,11 +61,15 @@ public class RegionLoader(float regionSize, string? importFolderPath = null, ILo { ulong node1Id = w.NodeIds[i - 1]; ulong node2Id = w.NodeIds[i]; - if (ret.Nodes.TryGetValue(node1Id, out Graph.Node? node1) && ret.Nodes.TryGetValue(node2Id, out Graph.Node? node2)) + if (ret.Nodes.TryGetValue(node1Id, out Graph.Node? node1)) { - node1.Neighbors.TryAdd(node2Id, w.ID); - node2.Neighbors.TryAdd(node1Id, w.ID); //TODO add oneway checks + node1.Neighbors.TryAdd(node2Id, w.ID); + } + if (ret.Nodes.TryGetValue(node2Id, out Graph.Node? node2)) + { + //TODO add oneway checks + node2.Neighbors.TryAdd(node1Id, w.ID); } } }