summaryrefslogtreecommitdiffhomepage
path: root/src/world.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2024-01-16 06:12:29 +0100
committerStanislaw Halik <sthalik@misaki.pl>2024-01-16 06:12:29 +0100
commitcb0069f839db3d8f4748dd8e39f0d3830bfdf352 (patch)
tree1b7cd5486935f5d478f714f34656a9feec864b05 /src/world.hpp
parent8cf6c38140e505d787d2db12edbd638a91fa2dfc (diff)
c
Diffstat (limited to 'src/world.hpp')
-rw-r--r--src/world.hpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/world.hpp b/src/world.hpp
index 55331f49..4ffac90d 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -1,11 +1,10 @@
#pragma once
-#include "compat/defs.hpp"
+#include "compat/safe-ptr.hpp"
#include "chunk.hpp"
#include "global-coords.hpp"
#include "object-type.hpp"
#include <memory>
#include <unordered_map>
-#include <tsl/robin_map.h>
#include <Corrade/Utility/Move.h>
namespace floormat {
@@ -22,23 +21,19 @@ public:
static constexpr size_t initial_collect_every = 64;
private:
- struct chunk_tuple final {
+ struct chunk_tuple
+ {
static constexpr chunk_coords_ invalid_coords = { -1 << 15, -1 << 15, chunk_z_min };
chunk* c = nullptr;
chunk_coords_ pos = invalid_coords;
} _last_chunk;
- struct object_id_hasher
- {
- size_t operator()(object_id id) const noexcept;
- };
-
- struct chunk_coords_hasher {
- size_t operator()(const chunk_coords_& coord) const noexcept;
- };
+ struct object_id_hasher { size_t operator()(object_id id) const noexcept; };
+ struct chunk_coords_hasher { size_t operator()(const chunk_coords_& coord) const noexcept; };
+ struct robin_map_wrapper;
std::unordered_map<chunk_coords_, chunk, chunk_coords_hasher> _chunks;
- tsl::robin_map<object_id, std::weak_ptr<object>, object_id_hasher> _objects;
+ safe_ptr<robin_map_wrapper> _objects;
size_t _last_collection = 0;
size_t _collect_every = initial_collect_every;
std::shared_ptr<char> _unique_id = std::make_shared<char>('A');
@@ -109,8 +104,6 @@ public:
world& operator=(world&& w) noexcept;
world(world&& w) noexcept;
-
- fm_DECLARE_DEPRECATED_COPY_ASSIGNMENT(world);
};
template<typename T>