1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Close #13125: Selecting the RCT2 files now uses localised dialogs

This commit is contained in:
Keith Stellyes
2020-10-09 12:13:14 -07:00
committed by GitHub
parent e23c1cded7
commit 3468d1fc6b
9 changed files with 38 additions and 30 deletions

View File

@@ -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)

View File

@@ -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 #

View File

@@ -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)
------------------------------------------------------------------------

View File

@@ -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);

View File

@@ -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)

View File

@@ -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&)

View File

@@ -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
{

View File

@@ -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);

View File

@@ -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
};