From 880a2672521b7ef6915b67fc8d246d361d6d24a3 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Fri, 6 Nov 2020 11:59:02 +0100 Subject: [PATCH] Implement @ZehMatt's suggestions --- src/openrct2/object/ObjectRepository.cpp | 27 +++--------------------- 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 78864f511e..cda814a397 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -47,27 +47,6 @@ using namespace OpenRCT2; -struct ObjectIdentifierHash -{ - size_t operator()(std::string_view identifier) const - { - uint32_t hash = 5381; - for (auto i : identifier) - { - hash = ((hash << 5) + hash) + i; - } - return hash; - } -}; - -struct ObjectIdentifierEqual -{ - bool operator()(std::string_view lhs, std::string_view rhs) const - { - return lhs == rhs; - } -}; - struct ObjectEntryHash { size_t operator()(const rct_object_entry& entry) const @@ -89,7 +68,7 @@ struct ObjectEntryEqual } }; -using ObjectIdentifierMap = std::unordered_map; +using ObjectIdentifierMap = std::unordered_map; using ObjectEntryMap = std::unordered_map; class ObjectFileIndex final : public FileIndex @@ -467,7 +446,7 @@ private: { rct_object_entry entry = _items[i].ObjectEntry; _itemMap[entry] = i; - if (_items[i].Identifier != "") + if (!_items[i].Identifier.empty()) { _newItemMap[_items[i].Identifier] = i; } @@ -499,7 +478,7 @@ private: auto copy = item; copy.Id = index; _items.push_back(copy); - if (item.Identifier != "") + if (!item.Identifier.empty()) { _newItemMap[item.Identifier] = index; }