summaryrefslogtreecommitdiffstats
path: root/game/shared/world/voxel_registry.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
committeruntodesu <kirill@untode.su>2025-12-11 15:14:26 +0500
commitf40d09cb8f712e87691af4912f3630d92d692779 (patch)
tree7ac3a4168ff722689372fd489c6f94d0a2546e8f /game/shared/world/voxel_registry.cc
parent8bcbd2729388edc63c82d77d314b583af1447c49 (diff)
downloadvoxelius-f40d09cb8f712e87691af4912f3630d92d692779.tar.bz2
voxelius-f40d09cb8f712e87691af4912f3630d92d692779.zip
Shuffle stuff around
- Use the new and improved hierarchy I figured out when making Prospero chat - Re-add NSIS scripts, again from Prospero - Update most build and utility scripts with their most recent versions
Diffstat (limited to 'game/shared/world/voxel_registry.cc')
-rw-r--r--game/shared/world/voxel_registry.cc64
1 files changed, 0 insertions, 64 deletions
diff --git a/game/shared/world/voxel_registry.cc b/game/shared/world/voxel_registry.cc
deleted file mode 100644
index 573a606..0000000
--- a/game/shared/world/voxel_registry.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "shared/pch.hh"
-
-#include "shared/world/voxel_registry.hh"
-
-static std::uint64_t registry_checksum = 0U;
-emhash8::HashMap<std::string, voxel_id> world::voxel_registry::names;
-std::vector<std::unique_ptr<world::Voxel>> world::voxel_registry::voxels;
-
-static void recalculate_checksum(void)
-{
- registry_checksum = 0U;
-
- for(const auto& voxel : world::voxel_registry::voxels) {
- registry_checksum = voxel->get_checksum(registry_checksum);
- }
-}
-
-world::Voxel* world::voxel_registry::register_voxel(const VoxelBuilder& builder)
-{
- assert(builder.get_name().size());
- assert(nullptr == find(builder.get_name()));
-
- const auto id = static_cast<voxel_id>(1 + voxels.size());
-
- std::unique_ptr<Voxel> voxel(builder.build(id));
- names.emplace(std::string(builder.get_name()), id);
- voxels.push_back(std::move(voxel));
-
- recalculate_checksum();
-
- return voxels.back().get();
-}
-
-world::Voxel* world::voxel_registry::find(std::string_view name)
-{
- const auto it = names.find(std::string(name));
-
- if(it == names.end()) {
- return nullptr;
- }
-
- return voxels[it->second - 1].get();
-}
-
-world::Voxel* world::voxel_registry::find(voxel_id id)
-{
- if(id == NULL_VOXEL_ID || id > voxels.size()) {
- return nullptr;
- }
-
- return voxels[id - 1].get();
-}
-
-void world::voxel_registry::purge(void)
-{
- registry_checksum = 0U;
- voxels.clear();
- names.clear();
-}
-
-std::uint64_t world::voxel_registry::get_checksum(void)
-{
- return registry_checksum;
-}