From c5aececcb1cd78290cbc24d179b82739dee90558 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Tue, 13 Mar 2018 00:30:27 +0100 Subject: [PATCH] Set scenario save path upon successfully loading a park Instead of setting the path when clicking on a file in the loadsave dialog, it's now set when the park gets actually loaded. This fixes the System Dialog not showing when saving a park loaded from command. --- src/openrct2-ui/windows/LoadSave.cpp | 3 --- src/openrct2/Context.cpp | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/openrct2-ui/windows/LoadSave.cpp b/src/openrct2-ui/windows/LoadSave.cpp index 7f8cebf424..6901e4a68f 100644 --- a/src/openrct2-ui/windows/LoadSave.cpp +++ b/src/openrct2-ui/windows/LoadSave.cpp @@ -927,9 +927,6 @@ static void window_loadsave_select(rct_window *w, const char *path) switch (_type & 0x0F) { case (LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME): save_path(&gConfigGeneral.last_save_game_directory, pathBuffer); - safe_strcpy(gScenarioSavePath, pathBuffer, MAX_PATH); - safe_strcpy(gCurrentLoadedPath, pathBuffer, MAX_PATH); - gFirstTimeSaving = true; window_loadsave_invoke_callback(MODAL_RESULT_OK, pathBuffer); window_close_by_class(WC_LOADSAVE); gfx_invalidate_screen(); diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 960ca13024..09ec0ce153 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -34,6 +34,7 @@ #include "core/MemoryStream.h" #include "core/Path.hpp" #include "core/String.hpp" +#include "core/Util.hpp" #include "FileClassifier.h" #include "HandleParkLoad.h" #include "network/network.h" @@ -426,6 +427,9 @@ namespace OpenRCT2 if (result.Error == PARK_LOAD_ERROR_OK) { parkImporter->Import(); + String::Set(gScenarioSavePath, Util::CountOf(gScenarioSavePath), path.c_str()); + String::Set(gCurrentLoadedPath, Util::CountOf(gCurrentLoadedPath), path.c_str()); + gFirstTimeSaving = true; game_fix_save_vars(); sprite_position_tween_reset(); gScreenAge = 0;