From b219ab1ed4c1aa026ad8280917318d2898100932 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sun, 10 Mar 2024 18:48:23 +0100 Subject: [PATCH] Use LanguageGetString() if there is nothing to format --- src/openrct2-ui/windows/LoadSave.cpp | 3 +-- src/openrct2-ui/windows/Ride.cpp | 3 +-- src/openrct2/config/Config.cpp | 6 +++--- src/openrct2/title/TitleScreen.cpp | 6 +++--- src/openrct2/world/Park.cpp | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 93000d8d75..ca1f80dc80 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -462,8 +462,7 @@ static Widget window_loadsave_widgets[] = auto buffer = park.Name; if (buffer.empty()) { - // Use localised "Unnamed Park" if park name was empty. - buffer = FormatStringID(STR_UNNAMED_PARK, nullptr); + buffer = LanguageGetString(STR_UNNAMED_PARK); } path = Path::Combine(path, buffer); } diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index b15df0d039..235dbcf2ca 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4855,8 +4855,7 @@ static_assert(std::size(RatingNames) == 6); auto& objManager = GetContext()->GetObjectManager(); auto musicObj = static_cast(objManager.GetLoadedObject(ObjectType::Music, musicObjectIndex)); - auto name = musicObj->NameStringId; - return FormatStringID(name, {}); + return LanguageGetString(musicObj->NameStringId); } /** diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index a4534b5721..d44e8bcb5e 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -841,7 +841,7 @@ bool ConfigFindOrBrowseInstallDirectory() auto uiContext = GetContext()->GetUiContext(); if (!uiContext->HasFilePicker()) { - uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES_MANUAL, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_NEEDS_RCT2_FILES_MANUAL)); return false; } @@ -850,7 +850,7 @@ bool ConfigFindOrBrowseInstallDirectory() const char* g1DatPath = PATH_SEPARATOR "Data" PATH_SEPARATOR "g1.dat"; while (true) { - uiContext->ShowMessageBox(FormatStringID(STR_NEEDS_RCT2_FILES, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_NEEDS_RCT2_FILES)); std::string gog = LanguageGetString(STR_OWN_ON_GOG); std::string hdd = LanguageGetString(STR_INSTALLED_ON_HDD); @@ -889,7 +889,7 @@ bool ConfigFindOrBrowseInstallDirectory() std::string dummy; if (!Platform::FindApp("innoextract", &dummy)) { - uiContext->ShowMessageBox(FormatStringID(STR_INSTALL_INNOEXTRACT, nullptr)); + uiContext->ShowMessageBox(LanguageGetString(STR_INSTALL_INNOEXTRACT)); return false; } diff --git a/src/openrct2/title/TitleScreen.cpp b/src/openrct2/title/TitleScreen.cpp index 42192b387d..790663cd98 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; - const std::string RCT1String = FormatStringID(STR_TITLE_SEQUENCE_RCT1, nullptr); - const std::string RCT1AAString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA, nullptr); - const std::string RCT1LLString = FormatStringID(STR_TITLE_SEQUENCE_RCT1_AA_LL, nullptr); + const std::string RCT1String = LanguageGetString(STR_TITLE_SEQUENCE_RCT1); + const std::string RCT1AAString = LanguageGetString(STR_TITLE_SEQUENCE_RCT1_AA); + const std::string RCT1LLString = LanguageGetString(STR_TITLE_SEQUENCE_RCT1_AA_LL); // 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/Park.cpp b/src/openrct2/world/Park.cpp index 68ff18ee35..c68322a187 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -230,7 +230,7 @@ void Park::Initialise() { auto& gameState = GetGameState(); - Name = FormatStringID(STR_UNNAMED_PARK, nullptr); + Name = LanguageGetString(STR_UNNAMED_PARK); PluginStorage = {}; gameState.StaffHandymanColour = COLOUR_BRIGHT_RED; gameState.StaffMechanicColour = COLOUR_LIGHT_BLUE;