From f1330bf596b045131ba2906e0b99646835257456 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 22 Oct 2022 10:29:03 +0200 Subject: more dumb crap --- src/world.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/world.hpp b/src/world.hpp index 89bc4feb..6321606e 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -12,13 +12,13 @@ struct chunk; struct world final { - world(); std::shared_ptr operator[](chunk_coords c) noexcept; std::tuple, tile&> operator[](global_coords pt) noexcept; bool contains(chunk_coords c) const noexcept; void clear(); void collect(); + world(); fm_DECLARE_DELETED_COPY_ASSIGNMENT(world); private: @@ -26,13 +26,14 @@ private: static constexpr std::size_t initial_capacity = 64, collect_every = 32; static constexpr float max_load_factor = .5; - static constexpr auto hasher = [](chunk_coords c) -> std::size_t { + static constexpr auto hasher = [](chunk_coords c) constexpr -> std::size_t { return int_hash((std::size_t)c.y << 16 | (std::size_t)c.x); }; std::size_t _last_collection = 0; - mutable std::optional, chunk_coords>> _last_chunk; + std::unordered_map, decltype(hasher)> _chunks{initial_capacity, hasher}; + mutable std::optional, chunk_coords>> _last_chunk; }; } // namespace floormat -- cgit v1.2.3