From 9c7fec1c37b6f463a5b7c901d94a5198655d3c6e Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 9 Apr 2023 17:02:56 +0200 Subject: [PATCH] Fixed infinity error JSON --- Pathfinding/PathNode.cs | 2 +- Pathfinding/Pathfinder_Distance.cs | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Pathfinding/PathNode.cs b/Pathfinding/PathNode.cs index b5af0b0..9d8ef44 100644 --- a/Pathfinding/PathNode.cs +++ b/Pathfinding/PathNode.cs @@ -24,7 +24,7 @@ public class PathNode : OsmNode PathNode retNode = new PathNode(node.nodeId, node.coordinates) { currentPathLength = node.currentPathLength, - currentPathWeight = node.currentPathWeight, + currentPathWeight = double.IsPositiveInfinity(node.currentPathWeight) ? double.MaxValue : node.currentPathWeight, directDistanceToGoal = node.directDistanceToGoal }; return retNode; diff --git a/Pathfinding/Pathfinder_Distance.cs b/Pathfinding/Pathfinder_Distance.cs index 3e66471..485dfeb 100644 --- a/Pathfinding/Pathfinder_Distance.cs +++ b/Pathfinding/Pathfinder_Distance.cs @@ -32,8 +32,6 @@ public static partial class Pathfinder { neighbor.previousPathNode = closestNodeToGoal; neighbor.currentPathLength = newPotentialLength; - neighbor.currentPathWeight = closestNodeToGoal.currentPathWeight + - EdgeWeight(closestNodeToGoal, edge, Tag.SpeedType.road, regionManager); neighbor.directDistanceToGoal = Utils.DistanceBetween(neighbor, goalNode); if (neighbor.Equals(goalNode))