summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-26 21:05:46 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-26 21:07:46 +0200
commit978a605ada755b0a02f8e8ea768c3af7e40b4cd7 (patch)
tree6a06534f848a1bd62b10a1c23d5e34bce99da953
parent15874e375334a2e5e4cd44f438ca180d22deb02a (diff)
allow forced collecting empty tiles
-rw-r--r--src/world.cpp4
-rw-r--r--src/world.hpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/world.cpp b/src/world.cpp
index dcb1b4a3..07a83afe 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -51,12 +51,12 @@ void world::maybe_collect()
collect();
}
-void world::collect()
+void world::collect(bool force)
{
for (auto it = _chunks.begin(); it != _chunks.end(); (void)0)
{
const auto& [_, c] = *it;
- if (c.empty())
+ if (c.empty(force))
it = _chunks.erase(it);
else
++it;
diff --git a/src/world.hpp b/src/world.hpp
index 1b05a824..cbdec4f5 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -36,7 +36,7 @@ public:
std::tuple<chunk&, tile&> operator[](global_coords pt) noexcept;
bool contains(chunk_coords c) const noexcept;
void clear();
- void collect();
+ void collect(bool force = false);
[[deprecated]] const auto& chunks() const noexcept { return _chunks; } // only for serialization