mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-21 23:03:04 +01:00
Prevent closing object selection window when selection is invalid (#23968)
* EditorObjectSelectionWindowCheck: move window close out to caller side * WindowManager: apply CanClose check again * Amend changelog
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
- Fix: [#4225] Ride Construction window offers non-existent banked sloped to level curve (original bug).
|
||||
- Fix: [#10379] Banners outside the park can be renamed and modified (original bug).
|
||||
- Fix: [#10582] Low clearance tunnels below water are drawn incorrectly (original bug).
|
||||
- Fix: [#23486] Object selection minimum requirements can be bypassed with close window hotkey.
|
||||
- Fix: [#23743] Parks with guest goals over 32767 do not appear in the scenario list.
|
||||
- Fix: [#23844] Sound effects keep playing when loading another save.
|
||||
- Fix: [#23891] Inverted Hairpin Coaster track can draw over things above it (original bug).
|
||||
|
||||
@@ -931,6 +931,12 @@ public:
|
||||
*/
|
||||
void Close(WindowBase& w) override
|
||||
{
|
||||
if (!w.CanClose())
|
||||
{
|
||||
// Something's preventing this window from closing -- bail out early
|
||||
return;
|
||||
}
|
||||
|
||||
w.OnClose();
|
||||
|
||||
// Remove viewport
|
||||
|
||||
@@ -199,6 +199,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (!EditorObjectSelectionWindowCheck())
|
||||
return;
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
|
||||
FinishObjectSelection();
|
||||
if (gLegacyScene == LegacyScene::trackDesigner)
|
||||
{
|
||||
|
||||
@@ -366,9 +366,13 @@ namespace OpenRCT2::Ui::Windows
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
if (!(gLegacyScene == LegacyScene::trackDesignsManager) && !EditorObjectSelectionWindowCheck())
|
||||
{
|
||||
if (gLegacyScene != LegacyScene::trackDesignsManager && !EditorObjectSelectionWindowCheck())
|
||||
return;
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
|
||||
if (isInEditorMode())
|
||||
{
|
||||
FinishObjectSelection();
|
||||
@@ -382,6 +386,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
context->SetActiveScene(context->GetTitleScene());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WIDX_SUB_TAB_0:
|
||||
case WIDX_SUB_TAB_1:
|
||||
@@ -1708,17 +1713,15 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
bool EditorObjectSelectionWindowCheck()
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
|
||||
auto [missingObjectType, errorString] = Editor::CheckObjectSelection();
|
||||
if (missingObjectType == ObjectType::none)
|
||||
{
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
return true;
|
||||
}
|
||||
|
||||
ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::EditorObjectSelection);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user