summaryrefslogtreecommitdiffhomepage
path: root/src/world.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-02-04 13:59:58 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-02-04 13:59:58 +0100
commit295597008e0464f57eb52f51dc5d91ecb4e20cde (patch)
tree265298ead59fcfc7590ed66aa538fdeb068d8f5d /src/world.cpp
parente5659516ff0df4462d1e07308152cd1ebbedf182 (diff)
src/world: remove automatic garbage collection
It should be run in the update loop.
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp11
1 files changed, 0 insertions, 11 deletions
diff --git a/src/world.cpp b/src/world.cpp
index b393a403..59ea8d3d 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -45,8 +45,6 @@ world& world::operator=(world&& w) noexcept
_chunks = std::move(w._chunks);
_objects = std::move(w._objects);
w._objects = safe_ptr<robin_map_wrapper>{};
- _last_collection = w._last_collection;
- _collect_every = w._collect_every;
_unique_id = std::move(w._unique_id);
fm_debug_assert(_unique_id);
fm_debug_assert(w._unique_id == nullptr);
@@ -120,24 +118,16 @@ bool world::contains(chunk_coords_ c) const noexcept
void world::clear()
{
fm_assert(!_teardown);
- _last_collection = 0;
_chunks.clear();
_chunks.rehash(initial_capacity);
_objects->clear();
_objects->rehash(initial_capacity);
- _collect_every = initial_collect_every;
_object_counter = object_counter_init;
auto& [c, pos] = _last_chunk;
c = nullptr;
pos = chunk_tuple::invalid_coords;
}
-void world::maybe_collect()
-{
- if (_chunks.size() > _last_collection + _collect_every)
- collect();
-}
-
void world::collect(bool force)
{
const auto len0 = _chunks.size();
@@ -150,7 +140,6 @@ void world::collect(bool force)
++it;
}
- _last_collection = _chunks.size();
auto& [c, pos] = _last_chunk;
c = nullptr;
pos = chunk_tuple::invalid_coords;