diff options
-rw-r--r-- | src/path-search.cpp | 3 | ||||
-rw-r--r-- | test/path-search.cpp | 1 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/path-search.cpp b/src/path-search.cpp index 0ec4a91d..bab6b094 100644 --- a/src/path-search.cpp +++ b/src/path-search.cpp @@ -243,8 +243,7 @@ void path_search::fill_cache_(world& w, chunk_coords_ coord, Vector2ub own_size, int8_t z = coord.z; auto off = Vector2i(x - cache.start.x(), y - cache.start.y()); - fm_debug_assert(off.x() >= 0 && off.y() >= 0); - fm_debug_assert(off.x() < cache.size.x() && off.y() < cache.size.y()); + fm_debug_assert(off >= Vector2i{} && off < cache.size); auto ch = chunk_coords_{(int16_t)x, (int16_t)y, z}; auto* c = w.at(ch); auto nb = w.neighbors(ch); diff --git a/test/path-search.cpp b/test/path-search.cpp index f4c94e9c..63e78177 100644 --- a/test/path-search.cpp +++ b/test/path-search.cpp @@ -129,6 +129,7 @@ void test_bbox() static constexpr auto c_idx = [](path_search& search, chunk_coords ch) { auto ch_ = Vector2i(ch) - search.cache.start; + fm_assert(ch_ >= Vector2i{} && ch_ < search.cache.size); return ch_.y()*search.cache.size.x() + ch_.x(); }; static constexpr auto t_idx = [](local_coords tile) constexpr { |