mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 23:34:37 +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:
@@ -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