From bf5f7e8e71b23949e4ff3eab3d44329bd496e682 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Tue, 17 Jan 2023 09:59:07 +0100 Subject: [PATCH] Rename format_string(2) and is_user_string_id() (#19178) Co-authored-by: duncanspumpkin --- src/openrct2-ui/input/ShortcutInput.cpp | 8 ++++---- src/openrct2-ui/windows/Error.cpp | 4 ++-- src/openrct2-ui/windows/LoadSave.cpp | 2 +- src/openrct2-ui/windows/Options.cpp | 4 ++-- src/openrct2-ui/windows/Ride.cpp | 2 +- src/openrct2-ui/windows/TextInput.cpp | 2 +- src/openrct2/actions/GameActionResult.cpp | 2 +- src/openrct2/config/Config.cpp | 8 ++++---- src/openrct2/drawing/Text.cpp | 2 +- src/openrct2/entity/Peep.cpp | 2 +- src/openrct2/interface/Screenshot.cpp | 2 +- src/openrct2/localisation/Date.h | 2 +- src/openrct2/localisation/Formatting.cpp | 18 +++++++++--------- src/openrct2/localisation/Formatting.h | 8 ++++---- .../localisation/Localisation.Date.cpp | 2 +- src/openrct2/localisation/Localisation.cpp | 2 +- src/openrct2/localisation/Localisation.h | 4 ++-- src/openrct2/network/NetworkBase.cpp | 6 +++--- src/openrct2/rct1/S4Importer.cpp | 8 ++++---- src/openrct2/rct12/RCT12.cpp | 2 +- src/openrct2/rct2/S6Importer.cpp | 6 +++--- src/openrct2/ride/Ride.cpp | 2 +- .../scripting/bindings/entity/ScGuest.cpp | 2 +- src/openrct2/title/TitleScreen.cpp | 6 +++--- src/openrct2/world/Banner.cpp | 2 +- src/openrct2/world/Park.cpp | 2 +- test/tests/FormattingTests.cpp | 2 +- 27 files changed, 56 insertions(+), 56 deletions(-) diff --git a/src/openrct2-ui/input/ShortcutInput.cpp b/src/openrct2-ui/input/ShortcutInput.cpp index 0da6ee87eb..dd147ee40d 100644 --- a/src/openrct2-ui/input/ShortcutInput.cpp +++ b/src/openrct2-ui/input/ShortcutInput.cpp @@ -301,20 +301,20 @@ std::string ShortcutInput::ToString(bool localised) const switch (Button) { case 0: - result += localised ? FormatStringId(STR_SHORTCUT_MOUSE_LEFT, Button + 1) : "LMB"; + result += localised ? FormatStringID(STR_SHORTCUT_MOUSE_LEFT, Button + 1) : "LMB"; break; case 1: - result += localised ? FormatStringId(STR_SHORTCUT_MOUSE_RIGHT, Button + 1) : "RMB"; + result += localised ? FormatStringID(STR_SHORTCUT_MOUSE_RIGHT, Button + 1) : "RMB"; break; default: - result += localised ? FormatStringId(STR_SHORTCUT_MOUSE_NUMBER, Button + 1) + result += localised ? FormatStringID(STR_SHORTCUT_MOUSE_NUMBER, Button + 1) : "MOUSE " + std::to_string(Button + 1); break; } } else if (Kind == InputDeviceKind::JoyButton) { - result += localised ? FormatStringId(STR_SHORTCUT_JOY_NUMBER, Button + 1) : "JOY " + std::to_string(Button + 1); + result += localised ? FormatStringID(STR_SHORTCUT_JOY_NUMBER, Button + 1) : "JOY " + std::to_string(Button + 1); } else if (Kind == InputDeviceKind::JoyHat) { diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 69f7395137..2f3b746f6a 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -163,7 +163,7 @@ rct_window* WindowErrorOpen(std::string_view title, std::string_view message) rct_window* WindowErrorOpen(StringId title, StringId message, const Formatter& args) { - auto titlez = format_string(title, args.Data()); - auto messagez = format_string(message, args.Data()); + auto titlez = FormatStringID(title, args.Data()); + auto messagez = FormatStringID(message, args.Data()); return WindowErrorOpen(titlez, messagez); } diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 06291d4a05..80ba5d0d58 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -462,7 +462,7 @@ static u8string OpenSystemFileBrowser(bool isSave) if (buffer.empty()) { // Use localised "Unnamed Park" if park name was empty. - buffer = format_string(STR_UNNAMED_PARK, nullptr); + buffer = FormatStringID(STR_UNNAMED_PARK, nullptr); } path = Path::Combine(path, buffer); } diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index e08946a735..66e8f0781a 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -1161,7 +1161,7 @@ private: for (size_t i = 0; i < 4; i++) { gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL; - gDropdownItems[i].Args = DateFormatStringIds[i]; + gDropdownItems[i].Args = DateFormatStringIDs[i]; } ShowDropdown(widget, 4); Dropdown::SetChecked(gConfigGeneral.DateFormat, true); @@ -1275,7 +1275,7 @@ private: } // Date format - widgets[WIDX_DATE_FORMAT].text = DateFormatStringIds[gConfigGeneral.DateFormat]; + widgets[WIDX_DATE_FORMAT].text = DateFormatStringIDs[gConfigGeneral.DateFormat]; // Temperature: celsius/fahrenheit widgets[WIDX_TEMPERATURE].text = gConfigGeneral.TemperatureFormat == TemperatureUnit::Fahrenheit ? STR_FAHRENHEIT diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index d136f3d3e1..b6cdc21ad9 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -5079,7 +5079,7 @@ static std::string GetMusicString(ObjectEntryIndex musicObjectIndex) auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicObjectIndex)); auto name = musicObj->NameStringId; - return format_string(name, {}); + return FormatStringID(name, {}); } /** diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 5404b69da4..63521e0d60 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -405,7 +405,7 @@ void WindowTextInputOpen( rct_window* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existing_text, uintptr_t existing_args, int32_t maxLength) { - auto existingText = format_string(existing_text, &existing_args); + auto existingText = FormatStringID(existing_text, &existing_args); WindowTextInputRawOpen(call_w, call_widget, title, description, descriptionArgs, existingText.c_str(), maxLength); } diff --git a/src/openrct2/actions/GameActionResult.cpp b/src/openrct2/actions/GameActionResult.cpp index 4d119c992d..4de6f06b55 100644 --- a/src/openrct2/actions/GameActionResult.cpp +++ b/src/openrct2/actions/GameActionResult.cpp @@ -25,7 +25,7 @@ namespace GameActions } std::string operator()(const StringId strId) const { - return format_string(strId, ErrorMessageArgs); + return FormatStringID(strId, ErrorMessageArgs); } }; diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 61977a5659..7767eb2dc9 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -827,7 +827,7 @@ bool ConfigFindOrBrowseInstallDirectory() auto uiContext = GetContext()->GetUiContext(); if (!uiContext->HasFilePicker()) { - uiContext->ShowMessageBox(format_string(STR_NEEDS_RCT2_FILES_MANUAL, nullptr)); + uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES_MANUAL, nullptr)); return false; } @@ -836,7 +836,7 @@ bool ConfigFindOrBrowseInstallDirectory() const char* g1DatPath = PATH_SEPARATOR "Data" PATH_SEPARATOR "g1.dat"; while (true) { - uiContext->ShowMessageBox(format_string(STR_NEEDS_RCT2_FILES, nullptr)); + uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES, nullptr)); std::string gog = LanguageGetString(STR_OWN_ON_GOG); std::string hdd = LanguageGetString(STR_INSTALLED_ON_HDD); @@ -875,7 +875,7 @@ bool ConfigFindOrBrowseInstallDirectory() std::string dummy; if (!Platform::FindApp("innoextract", &dummy)) { - uiContext->ShowMessageBox(format_string(STR_INSTALL_INNOEXTRACT, nullptr)); + uiContext->ShowMessageBox(FormatStringID(STR_INSTALL_INNOEXTRACT, nullptr)); return false; } @@ -913,7 +913,7 @@ bool ConfigFindOrBrowseInstallDirectory() return true; } - uiContext->ShowMessageBox(format_string(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); + uiContext->ShowMessageBox(FormatStringID(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); } } catch (const std::exception& ex) diff --git a/src/openrct2/drawing/Text.cpp b/src/openrct2/drawing/Text.cpp index c3cf1a2a11..1256f01ba1 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -180,7 +180,7 @@ int32_t DrawTextWrapped( const void* args = ft.Data(); // TODO: Refactor StaticLayout to take a std::string_view instead. It shouldn't have to write to the buffer. - const std::string buffer = format_string(format, args); + const std::string buffer = FormatStringID(format, args); StaticLayout layout(const_cast(buffer.c_str()), textPaint, width); if (textPaint.Alignment == TextAlignment::CENTRE) diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 0d6d941c62..1586d5b496 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -1596,7 +1596,7 @@ std::string Peep::GetName() const { Formatter ft; FormatNameTo(ft); - return format_string(STR_STRINGID, ft.Data()); + return FormatStringID(STR_STRINGID, ft.Data()); } bool Peep::SetName(std::string_view value) diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index ed3812ab4d..495086f39b 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -461,7 +461,7 @@ static void BenchgfxRenderScreenshots(const char* inputPath, std::unique_ptr(totalRenderCount); const auto engineStringId = DrawingEngineStringIds[EnumValue(DrawingEngine::Software)]; - const auto engineName = format_string(engineStringId, nullptr); + const auto engineName = FormatStringID(engineStringId, nullptr); std::printf("Engine: %s\n", engineName.c_str()); std::printf("Render Count: %u\n", totalRenderCount); for (ZoomLevel zoom{ 0 }; zoom < ZoomLevel::max(); zoom++) diff --git a/src/openrct2/localisation/Date.h b/src/openrct2/localisation/Date.h index fad9cbf980..3ca890e36c 100644 --- a/src/openrct2/localisation/Date.h +++ b/src/openrct2/localisation/Date.h @@ -44,7 +44,7 @@ struct openrct2_timeofday }; extern const int16_t days_in_month[MONTH_COUNT]; -extern const StringId DateFormatStringIds[]; +extern const StringId DateFormatStringIDs[]; extern const StringId DateFormatStringFormatIds[]; extern uint16_t gDateMonthTicks; diff --git a/src/openrct2/localisation/Formatting.cpp b/src/openrct2/localisation/Formatting.cpp index d70fe349f4..753f7cfb60 100644 --- a/src/openrct2/localisation/Formatting.cpp +++ b/src/openrct2/localisation/Formatting.cpp @@ -449,12 +449,12 @@ namespace OpenRCT2 if (minutes == 0) { auto fmt = Formats[0][seconds == 1 ? 0 : 1]; - FormatStringId(ss, fmt, seconds); + FormatStringID(ss, fmt, seconds); } else { auto fmt = Formats[minutes == 1 ? 1 : 2][seconds == 1 ? 0 : 1]; - FormatStringId(ss, fmt, minutes, seconds); + FormatStringID(ss, fmt, minutes, seconds); } } @@ -471,12 +471,12 @@ namespace OpenRCT2 if (hours == 0) { auto fmt = Formats[0][minutes == 1 ? 0 : 1]; - FormatStringId(ss, fmt, minutes); + FormatStringID(ss, fmt, minutes); } else { auto fmt = Formats[hours == 1 ? 1 : 2][minutes == 1 ? 0 : 1]; - FormatStringId(ss, fmt, hours, minutes); + FormatStringID(ss, fmt, hours, minutes); } } @@ -537,13 +537,13 @@ namespace OpenRCT2 { default: case MeasurementFormat::Imperial: - FormatStringId(ss, STR_UNIT_SUFFIX_MILES_PER_HOUR, arg); + FormatStringID(ss, STR_UNIT_SUFFIX_MILES_PER_HOUR, arg); break; case MeasurementFormat::Metric: - FormatStringId(ss, STR_UNIT_SUFFIX_KILOMETRES_PER_HOUR, mph_to_kmph(arg)); + FormatStringID(ss, STR_UNIT_SUFFIX_KILOMETRES_PER_HOUR, mph_to_kmph(arg)); break; case MeasurementFormat::SI: - FormatStringId(ss, STR_UNIT_SUFFIX_METRES_PER_SECOND, mph_to_dmps(arg)); + FormatStringID(ss, STR_UNIT_SUFFIX_METRES_PER_SECOND, mph_to_dmps(arg)); break; } } @@ -567,11 +567,11 @@ namespace OpenRCT2 { default: case MeasurementFormat::Imperial: - FormatStringId(ss, STR_UNIT_SUFFIX_FEET, metres_to_feet(arg)); + FormatStringID(ss, STR_UNIT_SUFFIX_FEET, metres_to_feet(arg)); break; case MeasurementFormat::Metric: case MeasurementFormat::SI: - FormatStringId(ss, STR_UNIT_SUFFIX_METRES, arg); + FormatStringID(ss, STR_UNIT_SUFFIX_METRES, arg); break; } } diff --git a/src/openrct2/localisation/Formatting.h b/src/openrct2/localisation/Formatting.h index d735ed6783..2b0b631d4d 100644 --- a/src/openrct2/localisation/Formatting.h +++ b/src/openrct2/localisation/Formatting.h @@ -284,22 +284,22 @@ namespace OpenRCT2 return CopyStringStreamToBuffer(buffer, bufferLen, ss); } - template static void FormatStringId(FormatBuffer& ss, StringId id, TArgs&&... argN) + template static void FormatStringID(FormatBuffer& ss, StringId id, TArgs&&... argN) { auto fmt = GetFmtStringById(id); FormatString(ss, fmt, argN...); } - template std::string FormatStringId(StringId id, TArgs&&... argN) + template std::string FormatStringID(StringId id, TArgs&&... argN) { auto fmt = GetFmtStringById(id); return FormatString(fmt, argN...); } - template size_t FormatStringId(char* buffer, size_t bufferLen, StringId id, TArgs&&... argN) + template size_t FormatStringID(char* buffer, size_t bufferLen, StringId id, TArgs&&... argN) { auto& ss = GetThreadFormatStream(); - FormatStringId(ss, id, argN...); + FormatStringID(ss, id, argN...); return CopyStringStreamToBuffer(buffer, bufferLen, ss); } diff --git a/src/openrct2/localisation/Localisation.Date.cpp b/src/openrct2/localisation/Localisation.Date.cpp index 2bd43dfcb1..dcd8a155fb 100644 --- a/src/openrct2/localisation/Localisation.Date.cpp +++ b/src/openrct2/localisation/Localisation.Date.cpp @@ -24,7 +24,7 @@ const int16_t days_in_month[MONTH_COUNT] = { 31, 30, 31, 30, 31, 31, 30, 31, }; -const StringId DateFormatStringIds[] = { +const StringId DateFormatStringIDs[] = { STR_DATE_FORMAT_DAY_MONTH_YEAR, STR_DATE_FORMAT_MONTH_DAY_YEAR, STR_DATE_FORMAT_YEAR_MONTH_DAY, diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index db0722ec72..3e58f07f23 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -328,7 +328,7 @@ const StringId DateGameShortMonthNames[MONTH_COUNT] = { }; // clang-format on -std::string format_string(StringId format, const void* args) +std::string FormatStringID(StringId format, const void* args) { std::string buffer(256, 0); size_t len{}; diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index 907726e9d1..72c97a5f55 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -18,7 +18,7 @@ #include -std::string format_string(StringId format, const void* args); +std::string FormatStringID(StringId format, const void* args); void format_string(char* dest, size_t size, StringId format, const void* args); void FormatStringToUpper(char* dest, size_t size, StringId format, const void* args); void generate_string_file(); @@ -41,7 +41,7 @@ size_t GetStringSize(const utf8* text); money64 StringToMoney(const char* string_to_monetise); void MoneyToString(money64 amount, char* buffer_to_put_value_to, size_t buffer_len, bool forceDecimals); -bool is_user_string_id(StringId stringId); +bool IsUserStringID(StringId stringId); #define MAX_USER_STRINGS 1024 #define USER_STRING_MAX_LENGTH 32 diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index 0e915790b2..912ab2847a 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -3089,7 +3089,7 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec case SERVER_EVENT_PLAYER_JOINED: { auto playerName = packet.ReadString(); - auto message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, playerName); + auto message = FormatStringID(STR_MULTIPLAYER_PLAYER_HAS_JOINED_THE_GAME, playerName); ChatAddHistory(message); break; } @@ -3100,11 +3100,11 @@ void NetworkBase::Client_Handle_EVENT([[maybe_unused]] NetworkConnection& connec std::string message; if (reason.empty()) { - message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_NO_REASON, playerName); + message = FormatStringID(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_NO_REASON, playerName); } else { - message = FormatStringId(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_WITH_REASON, playerName, reason); + message = FormatStringID(STR_MULTIPLAYER_PLAYER_HAS_DISCONNECTED_WITH_REASON, playerName, reason); } ChatAddHistory(message); break; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index e73cb6f32d..86b414e3eb 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -816,7 +816,7 @@ namespace RCT1 } // Ride name - if (is_user_string_id(src->name)) + if (IsUserStringID(src->name)) { dst->custom_name = GetUserString(src->name); } @@ -1286,7 +1286,7 @@ namespace RCT1 dst->sprite_direction = src->sprite_direction; // Peep name - if (is_user_string_id(src->name_string_idx)) + if (IsUserStringID(src->name_string_idx)) { dst->SetName(GetUserString(src->name_string_idx)); } @@ -2106,7 +2106,7 @@ namespace RCT1 void ImportParkName() { std::string parkName = std::string(_s4.scenario_name); - if (is_user_string_id(static_cast(_s4.park_name_string_index))) + if (IsUserStringID(static_cast(_s4.park_name_string_index))) { std::string userString = GetUserString(_s4.park_name_string_index); if (!userString.empty()) @@ -2398,7 +2398,7 @@ namespace RCT1 dst->flags |= BANNER_FLAG_NO_ENTRY; } - if (is_user_string_id(src->string_idx)) + if (IsUserStringID(src->string_idx)) { dst->text = GetUserString(src->string_idx); } diff --git a/src/openrct2/rct12/RCT12.cpp b/src/openrct2/rct12/RCT12.cpp index e669bf8f2a..a95c2191f7 100644 --- a/src/openrct2/rct12/RCT12.cpp +++ b/src/openrct2/rct12/RCT12.cpp @@ -462,7 +462,7 @@ uint8_t RCT12BannerElement::GetAllowedEdges() const return AllowedEdges & 0b00001111; } -bool is_user_string_id(StringId stringId) +bool IsUserStringID(StringId stringId) { return stringId >= 0x8000 && stringId < 0x9000; } diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 33d123ec3d..649049e25a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -794,7 +794,7 @@ namespace RCT2 dst->status = static_cast(src->status); dst->default_name_number = src->name_arguments_number; - if (is_user_string_id(src->name)) + if (IsUserStringID(src->name)) { dst->custom_name = GetUserString(src->name); } @@ -1160,7 +1160,7 @@ namespace RCT2 dst->type = RCTEntryIndexToOpenRCT2EntryIndex(src->type); dst->flags = src->flags; - if (!(src->flags & BANNER_FLAG_LINKED_TO_RIDE) && is_user_string_id(src->string_idx)) + if (!(src->flags & BANNER_FLAG_LINKED_TO_RIDE) && IsUserStringID(src->string_idx)) { dst->text = GetUserString(src->string_idx); } @@ -1686,7 +1686,7 @@ namespace RCT2 }; ImportEntityCommonProperties(static_cast(dst), src); - if (is_user_string_id(src->name_string_idx)) + if (IsUserStringID(src->name_string_idx)) { dst->SetName(GetUserString(src->name_string_idx)); } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index d9f122dc05..c3b56d1586 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -5549,7 +5549,7 @@ std::string Ride::GetName() const { Formatter ft; FormatNameTo(ft); - return format_string(STR_STRINGID, ft.Data()); + return FormatStringID(STR_STRINGID, ft.Data()); } void Ride::FormatNameTo(Formatter& ft) const diff --git a/src/openrct2/scripting/bindings/entity/ScGuest.cpp b/src/openrct2/scripting/bindings/entity/ScGuest.cpp index d47e4518c8..224d0f6a50 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -533,7 +533,7 @@ namespace OpenRCT2::Scripting // format string with arguments auto ft = Formatter(); peep_thought_set_format_args(&_backing, ft); - return format_string(STR_STRINGID, ft.Data()); + return FormatStringID(STR_STRINGID, ft.Data()); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 1599f1ae85..8d1433ff80 100644 --- a/src/openrct2/title/TitleScreen.cpp +++ b/src/openrct2/title/TitleScreen.cpp @@ -258,9 +258,9 @@ void TitleScreen::TitleInitialise() int32_t random = 0; bool safeSequence = false; - std::string RCT1String = format_string(STR_TITLE_SEQUENCE_RCT1, nullptr); - std::string RCT1AAString = format_string(STR_TITLE_SEQUENCE_RCT1_AA, nullptr); - std::string RCT1LLString = format_string(STR_TITLE_SEQUENCE_RCT1_AA_LL, nullptr); + std::string RCT1String = FormatStringID(STR_TITLE_SEQUENCE_RCT1, nullptr); + std::string RCT1AAString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA, nullptr); + std::string RCT1LLString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA_LL, nullptr); // Ensure the random sequence chosen isn't from RCT1 or expansion if the player doesn't have it installed while (!safeSequence) diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 6ae3e1ab7c..0b01b0608a 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -39,7 +39,7 @@ std::string Banner::GetText() const { Formatter ft; FormatTextTo(ft); - return format_string(STR_STRINGID, ft.Data()); + return FormatStringID(STR_STRINGID, ft.Data()); } void Banner::FormatTextTo(Formatter& ft, bool addColour) const diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index de99d09fce..6749e95b68 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -252,7 +252,7 @@ money64 Park::GetCompanyValue() const void Park::Initialise() { - Name = format_string(STR_UNNAMED_PARK, nullptr); + Name = FormatStringID(STR_UNNAMED_PARK, nullptr); PluginStorage = {}; gStaffHandymanColour = COLOUR_BRIGHT_RED; gStaffMechanicColour = COLOUR_LIGHT_BLUE; diff --git a/test/tests/FormattingTests.cpp b/test/tests/FormattingTests.cpp index 64b461c399..3a66558afa 100644 --- a/test/tests/FormattingTests.cpp +++ b/test/tests/FormattingTests.cpp @@ -317,7 +317,7 @@ TEST_F(FormattingTests, to_fixed_buffer) { char buffer[16]; std::memset(buffer, '\xFF', sizeof(buffer)); - auto len = FormatStringId(buffer, 8, STR_GUEST_X, 123); + auto len = FormatStringID(buffer, 8, STR_GUEST_X, 123); ASSERT_EQ(len, 9u); ASSERT_STREQ("Guest 1", buffer);