diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-25 19:20:29 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-02-25 19:20:29 +0100 |
commit | 8d0c254f45f3754142996d45434a67ec7ebc5dd9 (patch) | |
tree | 5ed904577967440cb7f9c37e9321d8f311f2f4d2 /test/region.cpp | |
parent | bd2aa935bfc2b377481ca5900d0d89168a507eae (diff) |
remove cached pass_region from chunk
This wasn't well thought out because the regiojn gets dirtied after
every critter movement, even though it ignores critters by default.
Diffstat (limited to 'test/region.cpp')
-rw-r--r-- | test/region.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/test/region.cpp b/test/region.cpp index 9b09cdf9..ab0d552a 100644 --- a/test/region.cpp +++ b/test/region.cpp @@ -49,16 +49,14 @@ void test1() { auto w = world(); auto& c = make_chunk1(w[COORD], true, false); - auto p = chunk::pass_region{}; - c.make_pass_region(p); + auto p = c.make_pass_region(); const auto count = p.bits.count(); fm_assert(count > 1000); fm_assert(p.bits.size() - count > 2000); - fm_assert(c.get_pass_region()->bits == p.bits); + fm_assert(c.make_pass_region().bits == p.bits); { auto w = world(); auto& c = make_chunk1(w[COORD], true, true); - auto p2 = chunk::pass_region{}; - c.make_pass_region(p2); + auto p2 = c.make_pass_region(); fm_assert(p2.bits.count() == count); } } @@ -67,15 +65,13 @@ void test2() { auto w = world(); auto& c = make_chunk1(w[COORD], false, false); - auto p = chunk::pass_region{}; - c.make_pass_region(p); + auto p = c.make_pass_region(); const auto count = p.bits.count(); fm_assert(count > 1000); fm_assert(p.bits.size() - count > 2000); { auto w = world(); auto& c = make_chunk1(w[COORD], false, true); - auto p2 = chunk::pass_region{}; - c.make_pass_region(p2); + auto p2 = c.make_pass_region(); fm_assert(p2.bits.count() == count); } } @@ -84,11 +80,10 @@ void test3() { auto w = world(); auto& c = make_chunk1(w[COORD], true, false); - const auto bits = c.get_pass_region()->bits; + const auto bits = c.make_pass_region().bits; fm_assert(bits.count() > 1000); - { auto p2 = chunk::pass_region{}; - c.make_pass_region(p2); + { auto p2 = c.make_pass_region(); fm_assert(p2.bits == bits); } @@ -96,10 +91,10 @@ void test3() fm_assert(c[{0, 0}].ground() != empty); c[{0, 0}].ground() = empty; - fm_assert(c.get_pass_region()->bits == bits); + fm_assert(c.make_pass_region().bits == bits); c.mark_passability_modified(); - fm_assert(c.get_pass_region()->bits != bits); + fm_assert(c.make_pass_region().bits != bits); } } |