mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add functions for closing top/all window(s)
This commit is contained in:
parent
1bedba626d
commit
b2d1f0dfd6
45
src/window.c
45
src/window.c
|
@ -1,5 +1,5 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014 Ted John
|
||||
* Copyright (c) 2014 Ted John, Peter Hill
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
|
@ -493,6 +493,47 @@ rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the top-most window
|
||||
*
|
||||
* rct2: 0x006E403C
|
||||
*/
|
||||
void window_close_top() {
|
||||
rct_window* w;
|
||||
|
||||
window_close_by_id(WC_DROPDOWN, 0);
|
||||
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & 2) {
|
||||
if (RCT2_ADDRESS(0x0141F570, uint8) != 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
|
||||
window_close(w);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all open windows
|
||||
*
|
||||
* rct2: 0x006EE927
|
||||
*/
|
||||
void window_close_all() {
|
||||
rct_window* w;
|
||||
|
||||
window_close_by_id(WC_DROPDOWN, 0);
|
||||
|
||||
for (w = RCT2_FIRST_WINDOW; w < RCT2_LAST_WINDOW; w++){
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))) {
|
||||
window_close(w);
|
||||
w = RCT2_FIRST_WINDOW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006EA845
|
||||
|
@ -1203,4 +1244,4 @@ void window_guest_list_init_vars_b() {
|
|||
RCT2_GLOBAL(0x00F1EE02, uint32) = 0xFFFFFFFF;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF;
|
||||
RCT2_GLOBAL(0x00F1AF20, uint16) = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,6 +291,8 @@ rct_window *window_create(int x, int y, int width, int height, uint32 *event_han
|
|||
rct_window *window_create_auto_pos(int width, int height, uint32 *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
void window_close(rct_window *window);
|
||||
void window_close_by_id(rct_windowclass cls, rct_windownumber number);
|
||||
void window_close_top();
|
||||
void window_close_all();
|
||||
rct_window *window_find_by_id(rct_windowclass cls, rct_windownumber number);
|
||||
rct_window *window_find_from_point(int x, int y);
|
||||
int window_find_widget_from_point(rct_window *w, int x, int y);
|
||||
|
|
Loading…
Reference in New Issue