diff --git a/src/openrct2/localisation/FormatCodes.cpp b/src/openrct2/localisation/FormatCodes.cpp index 204afcaa11..2b5c408520 100644 --- a/src/openrct2/localisation/FormatCodes.cpp +++ b/src/openrct2/localisation/FormatCodes.cpp @@ -9,13 +9,14 @@ #include "FormatCodes.h" +#include "../core/EnumMap.hpp" + #include #include -#include #include // clang-format off -static const std::unordered_map FormatTokenMap = { +static const EnumMap FormatTokenMap = { { "MOVE_X", FormatToken::Move, }, { "NEWLINE", FormatToken::Newline, }, { "NEWLINE_SMALLER", FormatToken::NewlineSmall, }, @@ -97,13 +98,10 @@ std::string_view FormatTokenToString(FormatToken token, bool withBraces) } else { - for (const auto& t : FormatTokenMap) - { - if (t.second == token) - { - return t.first; - } - } + auto it = FormatTokenMap.find(token); + if (it != FormatTokenMap.end()) + return it->first; + return {}; } }