From 28de14f9843e4ae26ed16e938f4d179b58122d76 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 23 Feb 2024 20:48:26 -0600 Subject: [PATCH] fix pathfinder A* using slightly suboptimal paths sometimes --- azalea/src/pathfinder/astar.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azalea/src/pathfinder/astar.rs b/azalea/src/pathfinder/astar.rs index cc1e2242..9e48ba2d 100644 --- a/azalea/src/pathfinder/astar.rs +++ b/azalea/src/pathfinder/astar.rs @@ -78,7 +78,7 @@ where .get(&neighbor.movement.target) .map(|n| n.g_score) .unwrap_or(f32::INFINITY); - if tentative_g_score - neighbor_g_score < MIN_IMPROVEMENT { + if neighbor_g_score - tentative_g_score > MIN_IMPROVEMENT { let heuristic = heuristic(neighbor.movement.target); let f_score = tentative_g_score + heuristic; nodes.insert(