From 1d3bd31ab874312ea19a5b083e49ee6a01c99fdb Mon Sep 17 00:00:00 2001 From: Duncan Date: Sun, 10 Mar 2024 18:15:49 +0000 Subject: [PATCH] Deduplicate FormatStringID symbols --- src/openrct2-ui/windows/Error.cpp | 4 ++-- src/openrct2-ui/windows/TextInput.cpp | 2 +- src/openrct2-ui/windows/Tooltip.cpp | 4 ++-- src/openrct2/actions/GameActionResult.cpp | 2 +- src/openrct2/config/Config.cpp | 2 +- src/openrct2/drawing/Text.cpp | 2 +- src/openrct2/entity/Peep.cpp | 2 +- src/openrct2/localisation/Localisation.cpp | 2 +- src/openrct2/localisation/Localisation.h | 2 +- src/openrct2/ride/Ride.cpp | 2 +- src/openrct2/scripting/bindings/entity/ScGuest.cpp | 2 +- src/openrct2/world/Banner.cpp | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/openrct2-ui/windows/Error.cpp b/src/openrct2-ui/windows/Error.cpp index 0ad3005c4a..1ba83e1758 100644 --- a/src/openrct2-ui/windows/Error.cpp +++ b/src/openrct2-ui/windows/Error.cpp @@ -168,8 +168,8 @@ static Widget window_error_widgets[] = { WindowBase* WindowErrorOpen(StringId title, StringId message, const Formatter& args) { - auto titlez = FormatStringID(title, args.Data()); - auto messagez = FormatStringID(message, args.Data()); + auto titlez = FormatStringIDLegacy(title, args.Data()); + auto messagez = FormatStringIDLegacy(message, args.Data()); return WindowErrorOpen(titlez, messagez); } } // namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index 0b1fb7a13b..ea78ce6948 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows WindowBase* call_w, WidgetIndex call_widget, StringId title, StringId description, const Formatter& descriptionArgs, StringId existing_text, uintptr_t existing_args, int32_t maxLength) { - auto existingText = FormatStringID(existing_text, &existing_args); + auto existingText = FormatStringIDLegacy(existing_text, &existing_args); WindowTextInputRawOpen(call_w, call_widget, title, description, descriptionArgs, existingText.c_str(), maxLength); } diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index 049d0d0c13..8417ba037b 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -131,11 +131,11 @@ static Widget _tooltipWidgets[] = { // Returns the width of the new tooltip text int32_t FormatTextForTooltip(const OpenRCT2String& message) { - const u8string tempString = ::FormatStringID(message.str, message.args.Data()); + const u8string tempString = FormatStringIDLegacy(message.str, message.args.Data()); OpenRCT2String formattedMessage{ STR_STRING_TOOLTIP, Formatter() }; formattedMessage.args.Add(tempString.c_str()); - const u8string tooltipTextUnwrapped = ::FormatStringID(formattedMessage.str, formattedMessage.args.Data()); + const u8string tooltipTextUnwrapped = FormatStringIDLegacy(formattedMessage.str, formattedMessage.args.Data()); auto textWidth = GfxGetStringWidthNewLined(tooltipTextUnwrapped, FontStyle::Small); textWidth = std::min(textWidth, 196); diff --git a/src/openrct2/actions/GameActionResult.cpp b/src/openrct2/actions/GameActionResult.cpp index 4de6f06b55..1d1d92fc4c 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 FormatStringID(strId, ErrorMessageArgs); + return FormatStringIDLegacy(strId, ErrorMessageArgs); } }; diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index d44e8bcb5e..9bcb48b865 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -927,7 +927,7 @@ bool ConfigFindOrBrowseInstallDirectory() return true; } - uiContext->ShowMessageBox(FormatStringID(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); + uiContext->ShowMessageBox(FormatStringIDLegacy(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 29efa04c28..e368a498b8 100644 --- a/src/openrct2/drawing/Text.cpp +++ b/src/openrct2/drawing/Text.cpp @@ -157,7 +157,7 @@ int32_t DrawTextWrapped( { const void* args = ft.Data(); - StaticLayout layout(FormatStringID(format, args), textPaint, width); + StaticLayout layout(FormatStringIDLegacy(format, args), textPaint, width); if (textPaint.Alignment == TextAlignment::CENTRE) { diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 1a28829cca..9584f4f9af 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -1586,7 +1586,7 @@ std::string Peep::GetName() const { Formatter ft; FormatNameTo(ft); - return ::FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } bool Peep::SetName(std::string_view value) diff --git a/src/openrct2/localisation/Localisation.cpp b/src/openrct2/localisation/Localisation.cpp index 4e5da98eae..753d5a5271 100644 --- a/src/openrct2/localisation/Localisation.cpp +++ b/src/openrct2/localisation/Localisation.cpp @@ -265,7 +265,7 @@ const StringId PeepThoughts[] = { }; // clang-format on -std::string FormatStringID(StringId format, const void* args) +std::string FormatStringIDLegacy(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 b7382de526..fe9da9f781 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -18,7 +18,7 @@ #include -std::string FormatStringID(StringId format, const void* args); +std::string FormatStringIDLegacy(StringId format, const void* args); void FormatStringToUpper(char* dest, size_t size, StringId format, const void* args); /** diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index bf838c6442..72e301d234 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -5712,7 +5712,7 @@ std::string Ride::GetName() const { Formatter ft; FormatNameTo(ft); - return FormatStringID(STR_STRINGID, reinterpret_cast(ft.Data())); + return FormatStringIDLegacy(STR_STRINGID, reinterpret_cast(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 c865e2c136..f6072f989d 100644 --- a/src/openrct2/scripting/bindings/entity/ScGuest.cpp +++ b/src/openrct2/scripting/bindings/entity/ScGuest.cpp @@ -830,7 +830,7 @@ namespace OpenRCT2::Scripting // format string with arguments auto ft = Formatter(); PeepThoughtSetFormatArgs(&_backing, ft); - return FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } } // namespace OpenRCT2::Scripting diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 6ae2f8c285..d116973d67 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -43,7 +43,7 @@ std::string Banner::GetText() const { Formatter ft; FormatTextTo(ft); - return FormatStringID(STR_STRINGID, ft.Data()); + return FormatStringIDLegacy(STR_STRINGID, ft.Data()); } void Banner::FormatTextTo(Formatter& ft, bool addColour) const