diff --git a/src/openrct2-cli/Cli.cpp b/src/openrct2-cli/Cli.cpp index cf6a55b04d..69b0b55f10 100644 --- a/src/openrct2-cli/Cli.cpp +++ b/src/openrct2-cli/Cli.cpp @@ -18,6 +18,7 @@ using namespace OpenRCT2; */ int main(int argc, const char** argv) { + int32_t rc = EXIT_SUCCESS; int runGame = cmdline_run(argv, argc); core_init(); if (runGame == 1) @@ -27,9 +28,11 @@ int main(int argc, const char** argv) // Run OpenRCT2 with a plain context auto context = CreateContext(); - if((context->RunOpenRCT2(argc, argv)) == EXIT_SUCCESS) { - return EXIT_SUCCESS; - } + rc = context->RunOpenRCT2(argc, argv); } - return EXIT_FAILURE; + else if (runGame == -1) + { + rc = EXIT_FAILURE; + } + return rc; } diff --git a/src/openrct2-ui/Ui.cpp b/src/openrct2-ui/Ui.cpp index 08bd347916..c3fc9324c7 100644 --- a/src/openrct2-ui/Ui.cpp +++ b/src/openrct2-ui/Ui.cpp @@ -39,6 +39,7 @@ int main(int argc, const char** argv) #endif { std::unique_ptr context; + int32_t rc = EXIT_SUCCESS; int runGame = cmdline_run(argv, argc); core_init(); RegisterBitmapReader(); @@ -57,11 +58,13 @@ int main(int argc, const char** argv) auto uiContext = to_shared(CreateUiContext(env)); context = CreateContext(env, audioContext, uiContext); } - if (context->RunOpenRCT2(argc, argv) == EXIT_SUCCESS) { - return EXIT_SUCCESS; - } + rc = context->RunOpenRCT2(argc, argv); } - return EXIT_FAILURE; + else if (runGame == -1) + { + rc = EXIT_FAILURE; + } + return rc; } #ifdef __ANDROID__