diff --git a/contributors.md b/contributors.md index e24dfaac3b..e81b848062 100644 --- a/contributors.md +++ b/contributors.md @@ -89,6 +89,7 @@ The following people are not part of the development team, but have been contrib * Hudson Oliveira (hdpoliveira) - Misc. * Jim Verheijde (Jimver) - Make handymen less likely to get stuck in queue lines, misc. * Helio Batimarqui (batimarqui) - Misc. +* Keith Stellyes - Misc. ## Bug fixes * (halfbro) diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index 07fda86941..e76908e5e1 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -3645,6 +3645,9 @@ STR_6386 :Blizzard STR_6387 :Can't lower element here… STR_6388 :Can't raise element here… STR_6389 :Invalid clearance +STR_6390 :OpenRCT2 needs files from the original RollerCoaster Tycoon 2 in order to work. Please select the directory where you installed RollerCoaster Tycoon 2. +STR_6391 :Please select your RCT2 directory +STR_6392 :Could not find {STRING} at this path. ############# # Scenarios # diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1e0d7c5017..b9f6fc7516 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -21,6 +21,7 @@ - Fix: [#13129] Missing error message when waiting for train to leave station on the ride measurements graph. - Fix: [#13138] Fix logical sorting of list windows. - Improved: [#13023] Made add_news_item console command last argument, assoc, optional. +- Improved: [#13125] Selecting the RCT2 files now uses localised dialogs. 0.3.1 (2020-09-27) ------------------------------------------------------------------------ diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 560889729b..6e4b70a98c 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -350,6 +350,24 @@ namespace OpenRCT2 config_save_default(); } + try + { + _localisationService->OpenLanguage(gConfigGeneral.language); + } + catch (const std::exception& e) + { + log_error("Failed to open configured language: %s", e.what()); + try + { + _localisationService->OpenLanguage(LANGUAGE_ENGLISH_UK); + } + catch (const std::exception& eFallback) + { + log_fatal("Failed to open fallback language: %s", eFallback.what()); + return false; + } + } + // TODO add configuration option to allow multiple instances // if (!gOpenRCT2Headless && !platform_lock_single_instance()) { // log_fatal("OpenRCT2 is already running."); @@ -379,24 +397,6 @@ namespace OpenRCT2 } #endif - try - { - _localisationService->OpenLanguage(gConfigGeneral.language, *_objectManager); - } - catch (const std::exception& e) - { - log_error("Failed to open configured language: %s", e.what()); - try - { - _localisationService->OpenLanguage(LANGUAGE_ENGLISH_UK, *_objectManager); - } - catch (const std::exception&) - { - log_fatal("Failed to open fallback language: %s", e.what()); - return false; - } - } - if (platform_process_is_elevated()) { std::string elevationWarning = _localisationService->GetString(STR_ADMIN_NOT_RECOMMENDED); diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index 824fdadbdc..a1a24be05d 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -22,6 +22,8 @@ #include "../localisation/Currency.h" #include "../localisation/Date.h" #include "../localisation/Language.h" +#include "../localisation/Localisation.h" +#include "../localisation/StringIds.h" #include "../network/network.h" #include "../paint/VirtualFloor.h" #include "../platform/Platform2.h" @@ -791,13 +793,13 @@ bool config_find_or_browse_install_directory() try { + const char* g1DatPath = PATH_SEPARATOR "Data" PATH_SEPARATOR "g1.dat"; while (true) { auto uiContext = GetContext()->GetUiContext(); - uiContext->ShowMessageBox("OpenRCT2 needs files from the original RollerCoaster Tycoon 2 in order to work.\n" - "Please select the directory where you installed RollerCoaster Tycoon 2."); + uiContext->ShowMessageBox(format_string(STR_NEEDS_RCT2_FILES, nullptr)); - std::string installPath = uiContext->ShowDirectoryDialog("Please select your RCT2 directory"); + std::string installPath = uiContext->ShowDirectoryDialog(format_string(STR_PICK_RCT2_DIR, nullptr)); if (installPath.empty()) { return false; @@ -811,9 +813,7 @@ bool config_find_or_browse_install_directory() return true; } - std::string message = String::StdFormat( - "Could not find %s" PATH_SEPARATOR "Data" PATH_SEPARATOR "g1.dat at this path", installPath.c_str()); - uiContext->ShowMessageBox(message); + uiContext->ShowMessageBox(format_string(STR_COULD_NOT_FIND_AT_PATH, &g1DatPath)); } } catch (const std::exception& ex) diff --git a/src/openrct2/localisation/Language.cpp b/src/openrct2/localisation/Language.cpp index 69edfa2637..341a9c71ea 100644 --- a/src/openrct2/localisation/Language.cpp +++ b/src/openrct2/localisation/Language.cpp @@ -101,7 +101,9 @@ bool language_open(int32_t id) auto& objectManager = context->GetObjectManager(); try { - localisationService.OpenLanguage(id, objectManager); + localisationService.OpenLanguage(id); + // Objects and their localised strings need to be refreshed + objectManager.ResetObjects(); return true; } catch (const std::exception&) diff --git a/src/openrct2/localisation/LocalisationService.cpp b/src/openrct2/localisation/LocalisationService.cpp index 1378e091be..cc5e381fbe 100644 --- a/src/openrct2/localisation/LocalisationService.cpp +++ b/src/openrct2/localisation/LocalisationService.cpp @@ -74,7 +74,7 @@ std::string LocalisationService::GetLanguagePath(uint32_t languageId) const return languagePath; } -void LocalisationService::OpenLanguage(int32_t id, IObjectManager& objectManager) +void LocalisationService::OpenLanguage(int32_t id) { CloseLanguages(); if (id == LANGUAGE_UNDEFINED) @@ -96,9 +96,6 @@ void LocalisationService::OpenLanguage(int32_t id, IObjectManager& objectManager { _currentLanguage = id; TryLoadFonts(*this); - - // Objects and their localised strings need to be refreshed - objectManager.ResetObjects(); } else { diff --git a/src/openrct2/localisation/LocalisationService.h b/src/openrct2/localisation/LocalisationService.h index 5dab276299..7868049247 100644 --- a/src/openrct2/localisation/LocalisationService.h +++ b/src/openrct2/localisation/LocalisationService.h @@ -60,7 +60,7 @@ namespace OpenRCT2::Localisation rct_string_id GetObjectOverrideStringId(const std::string_view& legacyIdentifier, uint8_t index) const; std::string GetLanguagePath(uint32_t languageId) const; - void OpenLanguage(int32_t id, IObjectManager& objectManager); + void OpenLanguage(int32_t id); void CloseLanguages(); rct_string_id AllocateObjectString(const std::string& target); void FreeObjectString(rct_string_id stringId); diff --git a/src/openrct2/localisation/StringIds.h b/src/openrct2/localisation/StringIds.h index 843bfce007..f6bc68a21c 100644 --- a/src/openrct2/localisation/StringIds.h +++ b/src/openrct2/localisation/StringIds.h @@ -3891,6 +3891,10 @@ enum STR_CANT_RAISE_ELEMENT_HERE = 6388, STR_NO_CLEARANCE = 6389, + STR_NEEDS_RCT2_FILES = 6390, + STR_PICK_RCT2_DIR = 6391, + STR_COULD_NOT_FIND_AT_PATH = 6392 + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working /* MAX_STR_COUNT = 32768 */ // MAX_STR_COUNT - upper limit for number of strings, not the current count strings };