summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-15 14:52:54 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-15 15:09:09 +0100
commit2e0c0009806860e4e8ac24663afdc5d926d1213f (patch)
tree24a88dfa818e52179b0955a463da4b9cfa834b4d /test
parentc6c3c887e99c57fb567252053190ce4a24f65455 (diff)
src: add O(1) chunk access from entity
Diffstat (limited to 'test')
-rw-r--r--test/json.cpp3
-rw-r--r--test/tile-iter.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/test/json.cpp b/test/json.cpp
index 60e464f6..349219b1 100644
--- a/test/json.cpp
+++ b/test/json.cpp
@@ -20,7 +20,8 @@ static chunk make_test_chunk()
metal2 = loader.tile_atlas("metal2", {2, 2}, pass_mode::blocked),
tiles = loader.tile_atlas("tiles", {8, 5}, pass_mode::pass);
constexpr auto N = TILE_MAX_DIM;
- chunk c;
+ world w;
+ chunk c{w};
for (auto [x, k, pt] : c) {
x.ground() = { tiles, variant_t(k % tiles->num_tiles()) };
}
diff --git a/test/tile-iter.cpp b/test/tile-iter.cpp
index 9d31fd49..7b9eafbf 100644
--- a/test/tile-iter.cpp
+++ b/test/tile-iter.cpp
@@ -12,7 +12,8 @@ void test_app::test_tile_iter() // NOLINT(readability-function-size)
{
if (always_false())
{
- const chunk c;
+ world w;
+ const chunk c{w};
for ([[maybe_unused]] const auto& [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), const tile_proto>);
for ([[maybe_unused]] const auto [x, k, pt] : c)
@@ -22,7 +23,8 @@ void test_app::test_tile_iter() // NOLINT(readability-function-size)
}
if (always_false())
{
- chunk c;
+ world w;
+ chunk c{w};
for ([[maybe_unused]] auto [x, k, pt] : c)
static_assert(std::is_same_v<decltype(x), tile_ref>);
for ([[maybe_unused]] const auto [x, k, pt] : c)