summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-17 00:20:44 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-17 00:20:44 +0200
commit1c4d7b84544ef44ce43f76b42ecdf389015de4e6 (patch)
tree1aac4e3a83d7656c63a79b4c5c3e2abfff2f4ef5
parent07ae849c48de49b2644e78fa02fda63275104164 (diff)
cc
-rw-r--r--src/path-search-dijkstra.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/path-search-dijkstra.cpp b/src/path-search-dijkstra.cpp
index 5dd69519..32aaff43 100644
--- a/src/path-search-dijkstra.cpp
+++ b/src/path-search-dijkstra.cpp
@@ -200,8 +200,6 @@ path_search_result astar::Dijkstra(world& w, const point from_, const point to_,
<< " pos:" << closest_pos;
#endif
- const auto bb0 = bbox_from_pos(Vector2(cur_pt.local()), cur_pt.offset(), own_size);
-
if (auto dist_to_goal = distance(cur_pt, to_); dist_to_goal < goal_thres) [[unlikely]]
{
if (auto dist = cur_dist + dist_to_goal; dist < max_dist)
@@ -266,7 +264,8 @@ path_search_result astar::Dijkstra(world& w, const point from_, const point to_,
fresh = false;
}
- { auto vec_ = Vector2(vec);
+ { const auto bb0 = bbox_from_pos(Vector2(cur_pt.local()), cur_pt.offset(), own_size);
+ auto vec_ = Vector2(vec);
auto bb1 = bbox<float>{ bb0.min + vec_, bb0.max + vec_ };
auto bb = bbox_union(bb0, bb1);
if (!path_search::is_passable(w, new_coord.chunk3(), bb, own_id, p))