1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-10 09:32:29 +01:00

Use unordered_map and constify things in Legacy.cpp

This commit is contained in:
ζeh Matt
2025-04-21 02:48:12 +03:00
parent 0b581281c5
commit b30e1b406b

View File

@@ -24,11 +24,12 @@
#include "../ride/Track.h"
#include "ParkFile.h"
#include <map>
#include <array>
#include <unordered_map>
using namespace OpenRCT2;
static std::map<std::string_view, std::string_view> oldObjectIds = {
static const std::unordered_map<std::string_view, std::string_view> 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<std::string_view, std::string_view> DATPathNames = {
static const std::unordered_map<std::string_view, std::string_view> 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<std::string_view> GetDATPathName(std::string_view newPathName)
return std::nullopt;
}
static RCT2::FootpathMapping _extendedFootpathMappings[] = {
static constexpr auto _extendedFootpathMappings = std::to_array<RCT2::FootpathMapping>({
{ "rct1.path.tarmac", "rct1.footpath_surface.tarmac", "rct1.footpath_surface.queue_blue", "rct2.footpath_railings.wood" },
};
});
const RCT2::FootpathMapping* GetFootpathMapping(const ObjectEntryDescriptor& desc)
{