Added currentPathLength to OsmNode
This commit is contained in:
@ -28,6 +28,7 @@ public class Pathfinder
|
||||
List<OsmNode> toVisit = new() { startNode };
|
||||
OsmNode closestNodeToGoal = toVisit.First();
|
||||
closestNodeToGoal.currentPathWeight = 0;
|
||||
closestNodeToGoal.currentPathLength = 0;
|
||||
bool stop = false;
|
||||
|
||||
while (toVisit.Count > 0 && !stop)
|
||||
@ -57,6 +58,7 @@ public class Pathfinder
|
||||
{
|
||||
neighbor.previousPathNode = closestNodeToGoal;
|
||||
neighbor.currentPathWeight = newPotentialWeight;
|
||||
neighbor.currentPathLength = closestNodeToGoal.currentPathLength + Utils.DistanceBetween(closestNodeToGoal, neighbor);
|
||||
|
||||
if (neighbor.Equals(goalNode))
|
||||
stop = true;
|
||||
|
Reference in New Issue
Block a user