From b30e1b406be6225135b2ff5ec670c497025390be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Mon, 21 Apr 2025 02:48:12 +0300 Subject: [PATCH] Use unordered_map and constify things in Legacy.cpp --- src/openrct2/park/Legacy.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openrct2/park/Legacy.cpp b/src/openrct2/park/Legacy.cpp index ed6858ff4e..7bd140f2e6 100644 --- a/src/openrct2/park/Legacy.cpp +++ b/src/openrct2/park/Legacy.cpp @@ -24,11 +24,12 @@ #include "../ride/Track.h" #include "ParkFile.h" -#include +#include +#include using namespace OpenRCT2; -static std::map oldObjectIds = { +static const std::unordered_map oldObjectIds = { { "official.scgpanda", "rct2dlc.scenery_group.scgpanda" }, { "official.wtrpink", "rct2dlc.water.wtrpink" }, { "official.ttrftl07", "toontowner.scenery_small.ttrftl07" }, @@ -2194,7 +2195,7 @@ std::string_view MapToNewObjectIdentifier(std::string_view s) return ""; } -static std::map DATPathNames = { +static const std::unordered_map DATPathNames = { { "rct2.pathash", "PATHASH " }, { "rct2.pathcrzy", "PATHCRZY" }, { "rct2.pathdirt", "PATHDIRT" }, { "rct2.pathspce", "PATHSPCE" }, { "rct2.road", "ROAD " }, { "rct2.tarmacb", "TARMACB " }, { "rct2.tarmacg", "TARMACG " }, { "rct2.tarmac", "TARMAC " }, { "rct2.1920path", "1920PATH" }, @@ -2212,9 +2213,9 @@ std::optional GetDATPathName(std::string_view newPathName) return std::nullopt; } -static RCT2::FootpathMapping _extendedFootpathMappings[] = { +static constexpr auto _extendedFootpathMappings = std::to_array({ { "rct1.path.tarmac", "rct1.footpath_surface.tarmac", "rct1.footpath_surface.queue_blue", "rct2.footpath_railings.wood" }, -}; +}); const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc) {