From 37e9270c00f727b67f214e2fc64c1512b2207e64 Mon Sep 17 00:00:00 2001 From: WantDiscussion <62322762+WantDiscussion@users.noreply.github.com> Date: Sat, 25 Apr 2020 01:19:06 +1000 Subject: [PATCH] Close #6024: Closing object selection now advances to next step In the scenario editor and track designer X button in object selector will now close the object selector window and advance to the next stage instead of closing the scenario editor and track editor entirely and returning to the main menu. Co-authored-by: Gymnasiast --- distribution/changelog.txt | 1 + .../windows/EditorBottomToolbar.cpp | 10 ++-------- .../windows/EditorObjectSelection.cpp | 9 ++------- src/openrct2/EditorObjectSelectionSession.cpp | 19 +++++++++++++++++++ src/openrct2/EditorObjectSelectionSession.h | 3 ++- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d67fb02fff..017362e6ce 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -43,6 +43,7 @@ - Fix: [#11258] Properly remove format codes from imported strings. - Fix: [#11286] Fix banner tooltip colour. - Fix: Small red gardens in RCT1 saves are imported in the wrong colour. +- Improved: [#6024] The close button in the object selection now advances to the next step. - Improved: [#11157] Slimmer virtual floor lines. 0.2.5 (2020-03-24) diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index bafb11982b..71ae75d9d0 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -225,21 +226,14 @@ void window_editor_bottom_toolbar_jump_forward_from_object_selection() if (!window_editor_bottom_toolbar_check_object_selection()) return; + finish_object_selection(); if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { - set_every_ride_type_invented(); - set_every_ride_entry_invented(); context_open_window(WC_CONSTRUCT_RIDE); - gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER; - gfx_invalidate_screen(); } else { - set_all_scenery_items_invented(); - scenery_set_default_placement_configuration(); - gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; context_open_window(WC_MAP); - gfx_invalidate_screen(); } } diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index e6d145d2bf..1838abc86c 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -462,15 +462,10 @@ static void window_editor_object_selection_mouseup(rct_window* w, rct_widgetinde switch (widgetIndex) { case WIDX_CLOSE: + window_close(w); if (gScreenFlags & SCREEN_FLAGS_EDITOR) { - auto loadOrQuitAction = LoadOrQuitAction(LoadOrQuitModes::OpenSavePrompt, PM_SAVE_BEFORE_QUIT); - GameActions::Execute(&loadOrQuitAction); - } - else - { - // Used for in-game object selection cheat - window_close(w); + finish_object_selection(); } break; case WIDX_FILTER_RIDE_TAB_ALL: diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index dbfbf5c0e9..dd2b1d7ec5 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -20,6 +20,7 @@ #include "object/ObjectManager.h" #include "object/ObjectRepository.h" #include "ride/RideData.h" +#include "scenario/Scenario.h" #include "windows/Intent.h" #include "world/Footpath.h" #include "world/LargeScenery.h" @@ -375,6 +376,24 @@ void reset_selected_object_count_and_size() } } +void finish_object_selection() +{ + if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) + { + set_every_ride_type_invented(); + set_every_ride_entry_invented(); + gS6Info.editor_step = EDITOR_STEP_ROLLERCOASTER_DESIGNER; + gfx_invalidate_screen(); + } + else + { + set_all_scenery_items_invented(); + scenery_set_default_placement_configuration(); + gS6Info.editor_step = EDITOR_STEP_LANDSCAPE_EDITOR; + gfx_invalidate_screen(); + } +} + /** * Master objects are objects that are not * optional / required dependants of an diff --git a/src/openrct2/EditorObjectSelectionSession.h b/src/openrct2/EditorObjectSelectionSession.h index 913a22a560..80b515df6c 100644 --- a/src/openrct2/EditorObjectSelectionSession.h +++ b/src/openrct2/EditorObjectSelectionSession.h @@ -14,7 +14,7 @@ #include -enum INPUT_FLAGS +enum EDITOR_INPUT_FLAGS { INPUT_FLAG_EDITOR_OBJECT_1 = (1 << 1), INPUT_FLAG_EDITOR_OBJECT_2 = (1 << 2), @@ -30,6 +30,7 @@ void editor_object_flags_free(); void unload_unselected_objects(); void sub_6AB211(); void reset_selected_object_count_and_size(); +void finish_object_selection(); int32_t window_editor_object_selection_select_object(uint8_t bh, int32_t flags, const rct_object_entry* entry); /**