diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index d4655227f9..1d180c43f1 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4462,6 +4462,9 @@ STR_6150 :Invalid response from master server (no JSON number) STR_6151 :Master server failed to return servers STR_6152 :Invalid response from master server (no JSON array) STR_6153 :Pay to enter park / Pay per ride +STR_6154 :It is not recommended to run OpenRCT2 with elevated permissions. +STR_6155 :Neither KDialog nor Zenity are installed. Please install one, or configure from the command line. + ############# # Scenarios # diff --git a/src/openrct2-ui/UiContext.Linux.cpp b/src/openrct2-ui/UiContext.Linux.cpp index 9a8ae80260..a576ea1c41 100644 --- a/src/openrct2-ui/UiContext.Linux.cpp +++ b/src/openrct2-ui/UiContext.Linux.cpp @@ -21,9 +21,11 @@ #include #include #include +#include #include #include "UiContext.h" + #include namespace OpenRCT2 { namespace Ui @@ -371,7 +373,10 @@ namespace OpenRCT2 { namespace Ui static void ThrowMissingDialogApp() { - throw std::runtime_error("KDialog or Zenity not installed."); + IUiContext * uiContext = GetContext()->GetUiContext(); + std::string dialogMissingWarning = language_get_string(STR_MISSING_DIALOG_APPLICATION_ERROR); + uiContext->ShowMessageBox(dialogMissingWarning); + throw std::runtime_error(dialogMissingWarning); } }; diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 0348828978..30bec5c0cc 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -280,9 +280,30 @@ namespace OpenRCT2 config_save_default(); } + // TODO add configuration option to allow multiple instances + // if (!gOpenRCT2Headless && !platform_lock_single_instance()) { + // log_fatal("OpenRCT2 is already running."); + // return false; + // } //This comment was relocated so it would stay where it was in relation to the following lines of code. + + _objectRepository = CreateObjectRepository(_env); + _objectManager = CreateObjectManager(_objectRepository); + _trackDesignRepository = CreateTrackDesignRepository(_env); + _scenarioRepository = CreateScenarioRepository(_env); + + if (!language_open(gConfigGeneral.language)) + { + log_error("Failed to open configured language..."); + if (!language_open(LANGUAGE_ENGLISH_UK)) + { + log_fatal("Failed to open fallback language..."); + return false; + } + } + if (platform_process_is_elevated()) { - std::string elevationWarning = "For security reasons, it is strongly recommended not to run OpenRCT2 with elevated permissions."; + std::string elevationWarning = language_get_string(STR_ADMIN_NOT_RECOMMENDED); if (gOpenRCT2Headless) { Console::Error::WriteLine(elevationWarning.c_str()); @@ -305,26 +326,10 @@ namespace OpenRCT2 _uiContext->CreateWindow(); } - // TODO add configuration option to allow multiple instances - // if (!gOpenRCT2Headless && !platform_lock_single_instance()) { - // log_fatal("OpenRCT2 is already running."); - // return false; - // } - _objectRepository = CreateObjectRepository(_env); - _objectManager = CreateObjectManager(_objectRepository); - _trackDesignRepository = CreateTrackDesignRepository(_env); - _scenarioRepository = CreateScenarioRepository(_env); - if (!language_open(gConfigGeneral.language)) - { - log_error("Failed to open configured language..."); - if (!language_open(LANGUAGE_ENGLISH_UK)) - { - log_fatal("Failed to open fallback language..."); - return false; - } - } + + // TODO Ideally we want to delay this until we show the title so that we can // still open the game window and draw a progress screen for the creation diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index 2dc1d3d02f..3f7415840e 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3806,6 +3806,9 @@ enum { STR_PAID_ENTRY_PAID_RIDES = 6153, + STR_ADMIN_NOT_RECOMMENDED = 6154, + STR_MISSING_DIALOG_APPLICATION_ERROR = 6155, + // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 };