diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-26 17:52:33 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-26 17:52:33 +0200 |
commit | e2f6b9450cd4020e0528b8bd6a9b9f709436ea94 (patch) | |
tree | 6b2326178602f24238533f34cdee2042f9b8aa59 /test | |
parent | b1351006462e817e221ff9bdbfc2ad7122a79f1f (diff) |
a
Diffstat (limited to 'test')
-rw-r--r-- | test/path-search.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/test/path-search.cpp b/test/path-search.cpp index d08af0dc..6689e086 100644 --- a/test/path-search.cpp +++ b/test/path-search.cpp @@ -127,25 +127,24 @@ void test_bbox() search.ensure_allocated({-1, -1}, {0, 0}); search.fill_cache_(w, {0, 0, 0}, {}, {}); - const auto c_idx = [&](chunk_coords ch) - { + static constexpr auto c_idx = [](path_search& search, chunk_coords ch) { auto ch_ = Vector2i(ch) - search.cache.start; return ch_.y()*search.cache.size.x() + ch_.x(); }; - constexpr auto t_idx = [](local_coords tile) { + static constexpr auto t_idx = [](local_coords tile) constexpr { return (size_t)tile.y * TILE_MAX_DIM + (size_t)tile.x; }; - const auto check_north = [&](chunk_coords ch, local_coords tile) { - return search.cache.array[c_idx(ch)].can_go_north[t_idx(tile)]; + constexpr auto check_N = [&](path_search& search, chunk_coords ch, local_coords tile) { + return search.cache.array[c_idx(search, ch)].can_go_north[t_idx(tile)]; }; - const auto check_west = [&](chunk_coords ch, local_coords tile) { - return search.cache.array[c_idx(ch)].can_go_west[t_idx(tile)]; + constexpr auto check_W = [&](path_search& search, chunk_coords ch, local_coords tile) { + return search.cache.array[c_idx(search, ch)].can_go_west[t_idx(tile)]; }; - fm_assert( check_west ({}, {0, 0}) ); - fm_assert( check_north({}, {0, 0}) ); - fm_assert( !check_north({}, {K, K}) ); - fm_assert( !check_west ({}, {K, K}) ); + fm_assert( check_W(search, {}, {0, 0}) ); + fm_assert( check_N(search, {}, {0, 0}) ); + fm_assert( !check_N(search, {}, {K, K}) ); + fm_assert( !check_W(search, {}, {K, K}) ); } } |