diff --git a/Pathfinding/Pathfinder.cs b/Pathfinding/Pathfinder.cs index d074571..99c71cf 100644 --- a/Pathfinding/Pathfinder.cs +++ b/Pathfinding/Pathfinder.cs @@ -14,7 +14,7 @@ public class Pathfinder try { startRegion = regionManager.GetRegion(start); - startNode = (PathNode)ClosestNodeToCoordinates(start, startRegion)!; //TODO null handling + startNode = PathNode.FromNode(ClosestNodeToCoordinates(start, startRegion)!); //TODO null handling } catch (FileNotFoundException e) { @@ -23,7 +23,7 @@ public class Pathfinder try { goalRegion = regionManager.GetRegion(goal); - goalNode = (PathNode)ClosestNodeToCoordinates(goal, goalRegion)!; //TODO null handling + goalNode = PathNode.FromNode(ClosestNodeToCoordinates(goal, goalRegion)!); //TODO null handling } catch (FileNotFoundException e) { @@ -47,7 +47,7 @@ public class Pathfinder foreach (Connection connection in closestNodeToGoal.GetConnections()) { - PathNode? neighbor = (PathNode?)regionManager.GetNode(connection.endNodeCoordinates); + PathNode? neighbor = (PathNode)regionManager.GetNode(connection.endNodeCoordinates); if (neighbor != null && neighbor.currentPathWeight < closestNodeToGoal.currentPathWeight + Utils.DistanceBetween(closestNodeToGoal, neighbor)) { neighbor.previousPathNode = closestNodeToGoal;