summaryrefslogtreecommitdiffhomepage
path: root/src/world.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-28 18:08:13 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-28 18:08:13 +0200
commit7c02d3b8f1e6ec4ee82bdf1220da431b1cd1231e (patch)
treeeea6effd759fdc9cd81f33b732979854eb226e39 /src/world.hpp
parentfa07c1fd19e7fbd3b2757583708c4691c79025ed (diff)
serializer work
Diffstat (limited to 'src/world.hpp')
-rw-r--r--src/world.hpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/world.hpp b/src/world.hpp
index 84659753..fcbb97a2 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -22,9 +22,10 @@ private:
return int_hash((std::size_t)c.y << 16 | (std::size_t)c.x);
};
- std::unordered_map<chunk_coords, chunk, decltype(hasher)> _chunks{initial_capacity, hasher};
+ std::unordered_map<chunk_coords, chunk, decltype(hasher)> _chunks;
mutable std::tuple<chunk*, chunk_coords>_last_chunk;
std::size_t _last_collection = 0;
+ explicit world(std::size_t capacity);
public:
explicit world();
@@ -49,7 +50,7 @@ public:
template<typename Hash, typename Alloc, typename Pred>
world::world(std::unordered_map<chunk_coords, chunk, Hash, Alloc, Pred>&& chunks) :
- _chunks{std::max(initial_capacity, std::size_t(1/max_load_factor * 2 * chunks.size())), hasher}
+ world{std::max(initial_capacity, std::size_t(1/max_load_factor * 2 * chunks.size()))}
{
for (auto&& [coord, c] : chunks)
operator[](coord) = std::move(c);