From 8d0c254f45f3754142996d45434a67ec7ebc5dd9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 25 Feb 2024 19:20:29 +0100 Subject: 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. --- test/region.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'test') 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); } } -- cgit v1.2.3