Commits

Robin Harper  committed c1b23fa

added check if path was broken because the max steps were taken

  • Participants
  • Parent commits 47035ef

Comments (0)

Files changed (3)

File AstarPath/AstarPathfinder.cs

             var closed = new Grid();
             var start = Grid.FirstOrDefault(t => t.PointsInNode().Contains(inputStart));
             var goal = Grid.FirstOrDefault(t => t.PointsInNode().Contains(inputGoal));
+            bool broken = false;
 
             if (start != null && goal != null)
             {
                     {
                         opened.Clear();
                         closed.Clear();
+                        broken = true;
                         break;
                     }
                     var adjacentNodes = PathfinderUtilities.FindAdjacentNodes(
                     }
                 }
 
-                return (closed.Count > 0) ? PathToStart(goal) : new List<GridNode>();
+                return (!broken) ? PathToStart(goal) : new List<GridNode>();
             }
 
             throw new ArgumentNullException("start and/or goal could not be found in the current grid.", new Exception());

File AstarPath/bin/Debug/AstarPath.dll

Binary file modified.

File PathTester/bin/Debug/AstarPath.dll

Binary file modified.