From fe2d1e2372340317d0fd3dcd33d6cbe05ee9eaea Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Wed, 17 May 2023 20:27:04 +0200 Subject: [PATCH] Small symbol cleanup (#20229) * Remove unused generate_string_file() declaration * Move IsUserStringID() to RCT12.h The function is only used by RCT1/2 code, and the implementation is in RCT12.cpp * Move ScenarioTranslate() to ScenarioRepository.cpp Seems to have ended up in ObjectRepository.cpp by accident. --- src/openrct2/localisation/Localisation.h | 3 --- src/openrct2/object/ObjectRepository.cpp | 16 ---------------- src/openrct2/rct12/RCT12.h | 1 + src/openrct2/scenario/ScenarioRepository.cpp | 16 ++++++++++++++++ 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/openrct2/localisation/Localisation.h b/src/openrct2/localisation/Localisation.h index 9f8be0b0a0..75dda9c180 100644 --- a/src/openrct2/localisation/Localisation.h +++ b/src/openrct2/localisation/Localisation.h @@ -20,7 +20,6 @@ std::string FormatStringID(StringId format, const void* args); void FormatStringToUpper(char* dest, size_t size, StringId format, const void* args); -void generate_string_file(); /** * Formats sizeBytes into buf as a human readable text, e.x.: "1024 MB" @@ -40,8 +39,6 @@ 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 IsUserStringID(StringId stringId); - #define MAX_USER_STRINGS 1024 #define USER_STRING_MAX_LENGTH 32 diff --git a/src/openrct2/object/ObjectRepository.cpp b/src/openrct2/object/ObjectRepository.cpp index 9c3147e6b2..b723b9d120 100644 --- a/src/openrct2/object/ObjectRepository.cpp +++ b/src/openrct2/object/ObjectRepository.cpp @@ -690,22 +690,6 @@ std::unique_ptr ObjectRepositoryLoadObject(const RCTObjectEntry* objectE return object; } -void ScenarioTranslate(ScenarioIndexEntry* scenarioEntry) -{ - StringId localisedStringIds[3]; - if (LanguageGetLocalisedScenarioStrings(scenarioEntry->Name, localisedStringIds)) - { - if (localisedStringIds[0] != STR_NONE) - { - String::Set(scenarioEntry->Name, sizeof(scenarioEntry->Name), LanguageGetString(localisedStringIds[0])); - } - if (localisedStringIds[2] != STR_NONE) - { - String::Set(scenarioEntry->Details, sizeof(scenarioEntry->Details), LanguageGetString(localisedStringIds[2])); - } - } -} - size_t ObjectRepositoryGetItemsCount() { auto& objectRepository = GetContext()->GetObjectRepository(); diff --git a/src/openrct2/rct12/RCT12.h b/src/openrct2/rct12/RCT12.h index 1c9fa21b33..60c66735b3 100644 --- a/src/openrct2/rct12/RCT12.h +++ b/src/openrct2/rct12/RCT12.h @@ -870,6 +870,7 @@ uint8_t GetStationStyleFromIdentifier(u8string_view identifier); std::optional GetStyleFromMusicIdentifier(std::string_view identifier); void RCT12AddDefaultObjects(ObjectList& objectList); void AppendRequiredObjects(ObjectList& objectList, ObjectType objectType, const RCT12::EntryList& entryList); +bool IsUserStringID(StringId stringId); static constexpr money32 RCT12_COMPANY_VALUE_ON_FAILED_OBJECTIVE = 0x80000001; diff --git a/src/openrct2/scenario/ScenarioRepository.cpp b/src/openrct2/scenario/ScenarioRepository.cpp index 7e791fe974..c7371d49ef 100644 --- a/src/openrct2/scenario/ScenarioRepository.cpp +++ b/src/openrct2/scenario/ScenarioRepository.cpp @@ -804,3 +804,19 @@ bool ScenarioRepositoryTryRecordHighscore(const utf8* scenarioFileName, money64 IScenarioRepository* repo = GetScenarioRepository(); return repo->TryRecordHighscore(LocalisationService_GetCurrentLanguage(), scenarioFileName, companyValue, name); } + +void ScenarioTranslate(ScenarioIndexEntry* scenarioEntry) +{ + StringId localisedStringIds[3]; + if (LanguageGetLocalisedScenarioStrings(scenarioEntry->Name, localisedStringIds)) + { + if (localisedStringIds[0] != STR_NONE) + { + String::Set(scenarioEntry->Name, sizeof(scenarioEntry->Name), LanguageGetString(localisedStringIds[0])); + } + if (localisedStringIds[2] != STR_NONE) + { + String::Set(scenarioEntry->Details, sizeof(scenarioEntry->Details), LanguageGetString(localisedStringIds[2])); + } + } +}