From 95b940b807eb213e2e86a32f8f4cc98fd6b13400 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 10 Apr 2023 09:04:07 +0200 Subject: src/world: cleanup & fix hash stuff --- src/world.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/world.hpp') diff --git a/src/world.hpp b/src/world.hpp index 90067c35..2dce958c 100644 --- a/src/world.hpp +++ b/src/world.hpp @@ -4,8 +4,9 @@ #include "global-coords.hpp" #include "entity-type.hpp" #include "compat/exception.hpp" -#include +#include "compat/int-hash.hpp" #include +#include #include template<> @@ -17,6 +18,9 @@ namespace floormat { struct entity; template struct entity_type_; +struct object_id_hasher { + size_t operator()(object_id id) const noexcept { return int_hash(id); } +}; struct world final { @@ -32,7 +36,7 @@ private: } _last_chunk; std::unordered_map _chunks; - tsl::robin_map> _entities; + tsl::robin_map, object_id_hasher> _entities; size_t _last_collection = 0; size_t _collect_every = 64; std::shared_ptr _unique_id = std::make_shared('A'); -- cgit v1.2.3