summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-10-06 12:52:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-10-06 12:52:06 +0200
commitd402f109df796e691306879903ddf09b2328d9e6 (patch)
tree73dfd5a0eea545654dcf3b4250ff7b4ac91a027e /test
parent268e5aa4bfe6f46f1fd4b8ceb50c54904c7536bf (diff)
a
Diffstat (limited to 'test')
-rw-r--r--test/path-search.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/test/path-search.cpp b/test/path-search.cpp
index 269c8c79..9ff918e5 100644
--- a/test/path-search.cpp
+++ b/test/path-search.cpp
@@ -130,25 +130,14 @@ void test_bbox()
search.ensure_allocated({}, {});
search.fill_cache_(w, {0, 0, 0}, {}, {});
- 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, Vector2i subdiv) constexpr {
- constexpr auto stride = TILE_MAX_DIM * (size_t)div;
- auto jj = tile.y * (size_t)div + (size_t)subdiv.y();
- auto ii = tile.x * (size_t)div + (size_t)subdiv.x();
- return jj * stride + ii;
- };
constexpr auto check_N = [&](path_search& search, chunk_coords ch, local_coords tile, Vector2i subdiv) {
- auto c = c_idx(search, ch);
- auto t = t_idx(tile, subdiv);
+ auto c = search.cache_chunk_index(ch);
+ auto t = search.cache_tile_index(tile, subdiv);
return search.cache.array[c].can_go_north[t];
};
constexpr auto check_W = [&](path_search& search, chunk_coords ch, local_coords tile, Vector2i subdiv) {
- auto c = c_idx(search, ch);
- auto t = t_idx(tile, subdiv);
+ auto c = search.cache_chunk_index(ch);
+ auto t = search.cache_tile_index(tile, subdiv);
return search.cache.array[c].can_go_west[t];
};