diff --git a/source/pathfinding/a_star.cpp b/source/pathfinding/a_star.cpp index a2bff25..6a116b4 100644 --- a/source/pathfinding/a_star.cpp +++ b/source/pathfinding/a_star.cpp @@ -87,11 +87,11 @@ namespace omath::pathfinding const auto current_node = current_node_it->second; + closed_list.emplace(current, current_node); + if (current == end_vertex) return reconstruct_final_path(closed_list, current); - closed_list.emplace(current, current_node); - for (const auto& neighbor: nav_mesh.get_neighbors(current)) { if (closed_list.contains(neighbor))