1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 07:43:01 +01:00

Add shift and control modifiers to close window button (#18537)

Shift closes all but current window.
Control closes all windows of the same window class/type.

Co-authored-by: Chris Higgins <chrissywissywoo@hotmail.com>
Co-authored-by: Tulio Leao <tupaschoal@gmail.com>
This commit is contained in:
ccahiggins
2022-12-27 12:22:18 +00:00
committed by GitHub
parent 121d656698
commit 279675ba45
7 changed files with 93 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ std::list<std::shared_ptr<rct_window>> g_window_list;
rct_window* gWindowAudioExclusive;
widget_identifier gCurrentTextBox = { { WindowClass::Null, 0 }, 0 };
window_close_modifier gLastCloseModifier = { { WindowClass::Null, 0 }, CloseWindowModifier::None };
char gTextBoxInput[TEXT_INPUT_SIZE] = { 0 };
int32_t gTextBoxFrameNo = 0;
bool gUsingWidgetTextBox = false;
@@ -395,6 +396,19 @@ void window_close_all_except_flags(uint16_t flags)
window_close_by_condition([flags](rct_window* w) -> bool { return !(w->flags & flags); });
}
/**
* Closes all windows except the specified window number and class.
* @param number (dx)
* @param cls (cl) without bit 15 set
*/
void window_close_all_except_number_and_class(rct_windownumber number, WindowClass cls)
{
window_close_by_class(WindowClass::Dropdown);
window_close_by_condition([cls, number](rct_window* w) -> bool {
return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)));
});
}
/**
*
* rct2: 0x006EA845