diff --git a/contributors.md b/contributors.md index c728cff150..3939b85b09 100644 --- a/contributors.md +++ b/contributors.md @@ -205,6 +205,7 @@ The following people are not part of the development team, but have been contrib * (ReticulatingSplines) * Conrad Cash (HouseholdVTuber) * Michael Bickerton (mdbckrtn) +* Nehemiah Negussie (nehemiah-negussie) ## Toolchain @@ -272,4 +273,4 @@ Representation by Jacqui Lyons at Marjacq Ltd. Thanks to: Peter James Adcock, Joe Booth, and John Wardley -Licensed to Infogrames Interactive Inc. \ No newline at end of file +Licensed to Infogrames Interactive Inc. diff --git a/distribution/changelog.txt b/distribution/changelog.txt index eee751d6be..df170e6e7b 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -11,6 +11,7 @@ - Fix: [#18467] “Selected only” Object Selection filter is active in Track Designs Manager, and cannot be toggled. - Fix: [#18905] Ride Construction window theme is not applied correctly. - Fix: [#18911] Mini Golf station does not draw correctly from all angles. +- Fix: [#18971] New Game does not prompt for save before quitting. - Fix: [#19026] Park loan is clamped to a 32-bit integer. 0.4.3 (2022-12-14) diff --git a/src/openrct2-ui/windows/SavePrompt.cpp b/src/openrct2-ui/windows/SavePrompt.cpp index 1bc8d99e65..c2b5725aaa 100644 --- a/src/openrct2-ui/windows/SavePrompt.cpp +++ b/src/openrct2-ui/windows/SavePrompt.cpp @@ -64,6 +64,7 @@ static constexpr const StringId window_save_prompt_labels[][2] = { { STR_LOAD_GAME_PROMPT_TITLE, STR_SAVE_BEFORE_LOADING }, { STR_QUIT_GAME_PROMPT_TITLE, STR_SAVE_BEFORE_QUITTING }, { STR_QUIT_GAME_2_PROMPT_TITLE, STR_SAVE_BEFORE_QUITTING_2 }, + { STR_NEW_GAME, STR_SAVE_BEFORE_QUITTING }, }; // clang-format on diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index da457267dc..22599b6bc8 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -532,15 +532,6 @@ static void WindowTopToolbarMousedown(rct_window* w, WidgetIndex widgetIndex, Wi } } -static void WindowTopToolbarScenarioselectCallback(const utf8* path) -{ - window_close_by_class(WindowClass::EditorObjectSelection); - game_notify_map_change(); - GetContext()->LoadParkFromFile(path, false, true); - game_load_scripts(); - game_notify_map_changed(); -} - /** * * rct2: 0x0066C9EA @@ -573,9 +564,8 @@ static void WindowTopToolbarDropdown(rct_window* w, WidgetIndex widgetIndex, int { case DDIDX_NEW_GAME: { - auto intent = Intent(WindowClass::ScenarioSelect); - intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(WindowTopToolbarScenarioselectCallback)); - ContextOpenIntent(&intent); + auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt, PromptMode::SaveBeforeNewGame); + GameActions::Execute(&loadOrQuitAction); break; } case DDIDX_LOAD_GAME: diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 725be2a292..ca4234ca8e 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -736,6 +736,15 @@ static void game_load_or_quit_no_save_prompt_callback(int32_t result, const utf8 } } +static void NewGameWindowCallback(const utf8* path) +{ + window_close_by_class(WindowClass::EditorObjectSelection); + game_notify_map_change(); + GetContext()->LoadParkFromFile(path, false, true); + game_load_scripts(); + game_notify_map_changed(); +} + /** * * rct2: 0x0066DB79 @@ -778,6 +787,16 @@ void game_load_or_quit_no_save_prompt() title_load(); break; } + case PromptMode::SaveBeforeNewGame: + { + auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::CloseSavePrompt); + GameActions::Execute(&loadOrQuitAction); + tool_cancel(); + auto intent = Intent(WindowClass::ScenarioSelect); + intent.putExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast(NewGameWindowCallback)); + ContextOpenIntent(&intent); + break; + } default: game_unload_scripts(); openrct2_finish(); diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index d88f6f93e5..fae4eeaac1 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -469,6 +469,7 @@ enum class PromptMode : uint8_t SaveBeforeLoad = 0, SaveBeforeQuit, SaveBeforeQuit2, + SaveBeforeNewGame, Quit };