diff --git a/azalea/src/pathfinder/astar.rs b/azalea/src/pathfinder/astar.rs index d79a2d64..cd3ee119 100644 --- a/azalea/src/pathfinder/astar.rs +++ b/azalea/src/pathfinder/astar.rs @@ -66,11 +66,10 @@ where f_score: 0., index: 0, }); - let mut nodes: FxIndexMap
> = IndexMap::default(); + let mut nodes: FxIndexMap
= IndexMap::default(); nodes.insert( start, Node { - movement_data: None, came_from: usize::MAX, g_score: 0., }, @@ -89,7 +88,7 @@ where debug!("Nodes considered: {num_nodes}"); return Path { - movements: reconstruct_path(nodes, index), + movements: reconstruct_path(nodes, index, successors), is_partial: false, }; } @@ -115,7 +114,6 @@ where neighbor_heuristic = heuristic(*e.key()); neighbor_index = e.index(); e.insert(Node { - movement_data: Some(neighbor.movement.data), came_from: index, g_score: tentative_g_score, }); @@ -127,7 +125,6 @@ where neighbor_heuristic = heuristic(*e.key()); neighbor_index = e.index(); e.insert(Node { - movement_data: Some(neighbor.movement.data), came_from: index, g_score: tentative_g_score, }); @@ -189,7 +186,7 @@ where ); Path { - movements: reconstruct_path(nodes, best_path), + movements: reconstruct_path(nodes, best_path, successors), is_partial: true, } } @@ -206,32 +203,46 @@ fn determine_best_path(best_paths: [usize; 7], start: usize) -> usize { best_paths[0] } -fn reconstruct_path
( - mut nodes: FxIndexMap
>, +fn reconstruct_path
( + nodes: FxIndexMap
,
mut current_index: usize,
+ mut successors: SuccessorsFn,
) -> Vec