summaryrefslogtreecommitdiff
path: root/src/pathfinding.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/pathfinding.adb')
-rw-r--r--src/pathfinding.adb24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/pathfinding.adb b/src/pathfinding.adb
index 1435ecf..9e45ec1 100644
--- a/src/pathfinding.adb
+++ b/src/pathfinding.adb
@@ -143,6 +143,9 @@ package body Pathfinding is
Open_Set : Node_Sets.Set := Node_Sets.To_Set (Start);
Came_From : Node_To_Node_Maps.Map := Node_To_Node_Maps.Empty_Map;
+
+ New_G_Score : G_Score;
+ New_F_Score : F_Score;
begin
G_Scores := G_Score_Maps.Empty_Map;
G_Scores.Insert (Start, 0);
@@ -162,18 +165,15 @@ package body Pathfinding is
if not Open_Set.Contains (N) then
Open_Set.Insert (N);
end if;
- declare
- New_G_Score : G_Score := G_Scores.Element (Current) + 1;
- New_F_Score : F_Score := New_G_Score + Heuristic (N, Goal);
- begin
- if not G_Scores.Contains (N) or else
- New_G_Score < G_Scores.Element (N)
- then
- Came_From.Insert (N, Current);
- G_Scores.Insert (N, New_G_Score);
- F_Scores.Insert (N, New_F_Score);
- end if;
- end;
+ New_G_Score := G_Scores.Element (Current) + 1;
+ New_F_Score := New_G_Score + Heuristic (N, Goal);
+ if not G_Scores.Contains (N) or else
+ New_G_Score < G_Scores.Element (N)
+ then
+ Came_From.Insert (N, Current);
+ G_Scores.Insert (N, New_G_Score);
+ F_Scores.Insert (N, New_F_Score);
+ end if;
end if;
end loop;
end loop;