From f40d09cb8f712e87691af4912f3630d92d692779 Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Dec 2025 15:14:26 +0500 Subject: 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 --- game/shared/world/item_registry.cc | 68 -------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 game/shared/world/item_registry.cc (limited to 'game/shared/world/item_registry.cc') diff --git a/game/shared/world/item_registry.cc b/game/shared/world/item_registry.cc deleted file mode 100644 index 4e0932c..0000000 --- a/game/shared/world/item_registry.cc +++ /dev/null @@ -1,68 +0,0 @@ -#include "shared/pch.hh" - -#include "shared/world/item_registry.hh" - -#include "core/math/crc64.hh" - -#include "shared/world/voxel_registry.hh" - -static std::uint64_t registry_checksum = 0U; -std::unordered_map world::item_registry::names = {}; -std::vector> world::item_registry::items = {}; - -static void recalculate_checksum(void) -{ - registry_checksum = 0U; - - for(const auto& item : world::item_registry::items) { - registry_checksum = item->get_checksum(registry_checksum); - } -} - -world::Item* world::item_registry::register_item(const ItemBuilder& builder) -{ - assert(builder.get_name().size()); - assert(nullptr == find(builder.get_name())); - - const auto id = static_cast(1 + items.size()); - - std::unique_ptr item(builder.build(id)); - names.emplace(std::string(builder.get_name()), id); - items.push_back(std::move(item)); - - recalculate_checksum(); - - return items.back().get(); -} - -world::Item* world::item_registry::find(std::string_view name) -{ - const auto it = names.find(std::string(name)); - - if(it == names.end()) { - return nullptr; - } - - return items[it->second - 1].get(); -} - -world::Item* world::item_registry::find(const item_id item) -{ - if(item == NULL_ITEM_ID || item > items.size()) { - return nullptr; - } - - return items[item - 1].get(); -} - -void world::item_registry::purge(void) -{ - registry_checksum = 0U; - items.clear(); - names.clear(); -} - -std::uint64_t world::item_registry::get_checksum(void) -{ - return registry_checksum; -} -- cgit