diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-03 01:35:10 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-03 01:48:01 +0200 |
commit | 6538c66308b98bc0f9875355b1247502aff7c07c (patch) | |
tree | ac98846492ff23e83af41bd440c2c3521fcc42bc /src | |
parent | 181941780ae82c394754be42d28b92e57301fa77 (diff) |
src/search: add tiny constant value to bbox size
Diffstat (limited to 'src')
-rw-r--r-- | src/search-astar.cpp | 6 | ||||
-rw-r--r-- | src/search-astar.hpp | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/search-astar.cpp b/src/search-astar.cpp index 1f1663f9..e86e6bee 100644 --- a/src/search-astar.cpp +++ b/src/search-astar.cpp @@ -192,7 +192,7 @@ uint32_t astar::pop_from_heap() } path_search_result astar::Dijkstra(world& w, const point from, const point to, - object_id own_id, uint32_t max_dist, Vector2ub own_size_, + object_id own_id, uint32_t max_dist, Vector2ui own_size_, int debug, const pred& p) { #ifdef FM_NO_DEBUG @@ -207,7 +207,9 @@ path_search_result astar::Dijkstra(world& w, const point from, const point to, auto& cache = *_cache; cache.allocate(from, max_dist); - const auto own_size = Math::max(Vector2ui(own_size_), min_size); + constexpr auto size_max = uint32_t{tile_size_xy}*uint32_t{TILE_MAX_DIM}; + fm_assert(own_size_ < Vector2ui{size_max}); + const auto own_size = Math::max(own_size_, min_size); constexpr auto goal_thres = (uint32_t)(div_size.length() + 1.5f); if (from.coord().z() != to.coord().z()) [[unlikely]] diff --git a/src/search-astar.hpp b/src/search-astar.hpp index 61553f80..dee9f5d6 100644 --- a/src/search-astar.hpp +++ b/src/search-astar.hpp @@ -26,7 +26,7 @@ public: // todo add simple bresenham short-circuit path_search_result Dijkstra(world& w, point from, point to, - object_id own_id, uint32_t max_dist, Vector2ub own_size, + object_id own_id, uint32_t max_dist, Vector2ui own_size, int debug = 0, const pred& p = Search::never_continue()); private: |