diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-26 21:14:26 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-26 21:14:26 +0100 |
commit | 506e5cfa93e735bbbc7a54f0a13e52d96985cfb6 (patch) | |
tree | c294522e3ebabe48f253c1973830be1a4ad3533f /src/world.hpp | |
parent | 988bf5d0368cb16846c02ea1482ea7b051ab97cb (diff) |
src/world: collect empty chunks once per iteration
Diffstat (limited to 'src/world.hpp')
-rw-r--r-- | src/world.hpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/world.hpp b/src/world.hpp index b95baf62..3bfcf702 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -18,8 +18,6 @@ private: chunk_coords pos = invalid_coords; } _last_chunk; - void maybe_collect(); - static constexpr std::size_t initial_capacity = 64, collect_every = 64; static constexpr float max_load_factor = .5; static constexpr auto hasher = [](chunk_coords c) constexpr -> std::size_t { @@ -43,6 +41,7 @@ public: bool contains(chunk_coords c) const noexcept; void clear(); void collect(bool force = false); + void maybe_collect(); std::size_t size() const noexcept { return _chunks.size(); } [[deprecated]] const auto& chunks() const noexcept { return _chunks; } // only for serialization |