Fix neighbors not being added if they are not in the same region

This commit is contained in:
glax 2024-07-22 23:58:24 +02:00
parent 2bf19d1095
commit a0418a6fae

View File

@ -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);
}
}
}