diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 76cc8a1b9d..749c605b99 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -619,6 +619,7 @@ public: if (inventionListWindow == nullptr) { Close(); + return; } std::optional res; // Skip always researched items, so that the dragged item gets placed underneath them diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 2c8ea108b1..47d565b310 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -599,12 +599,14 @@ public: if (!objectSelectResult.Successful) return; - // Close any other open windows such as options/colour schemes to prevent a crash. - WindowCloseAll(); - // WindowClose(*w); + auto& objRepository = OpenRCT2::GetContext()->GetObjectRepository(); + _loadedObject = objRepository.LoadObject(listItem->repositoryItem); + auto& objManager = OpenRCT2::GetContext()->GetObjectManager(); + objManager.LoadObject(_loadedObject.get()->GetIdentifier()); // This function calls window_track_list_open ManageTracks(); + Close(); return; } @@ -1485,7 +1487,7 @@ private: { for (size_t i = 0; i < std::size(ObjectSelectionPages); i++) { - pressed_widgets &= ~(1 << (WIDX_TAB_1 + i)); + pressed_widgets &= ~(1ull << (WIDX_TAB_1 + i)); } pressed_widgets |= 1LL << (WIDX_TAB_1 + selected_tab); } diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index df87dc5461..609197f2c1 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -207,7 +207,7 @@ public: { case WIDX_CLOSE: Close(); - break; + return; case WIDX_TAB_1: case WIDX_TAB_2: case WIDX_TAB_3: @@ -216,7 +216,7 @@ public: case WIDX_TAB_6: case WIDX_TAB_7: SetPage(widx - WIDX_TAB_1); - break; + return; } switch (page)