mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 19:43:06 +01:00
Move 6EE65A to window.c + minor refactor
This commit is contained in:
35
src/window.c
35
src/window.c
@@ -1511,3 +1511,38 @@ void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds overlapping windows and moves them if possible
|
||||
* rct2: 0x006EE65A
|
||||
*/
|
||||
void window_move_overlapping(rct_window* window)
|
||||
{
|
||||
uint16 cx = window->width + window->x;
|
||||
uint16 dx = window->height + window->y;
|
||||
|
||||
for (rct_window* w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++) {
|
||||
if (w == window)
|
||||
continue;
|
||||
if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
|
||||
continue;
|
||||
if (w->x >= cx)
|
||||
continue;
|
||||
if (w->x + w->width <= window->x)
|
||||
continue;
|
||||
if (w->y >= dx)
|
||||
continue;
|
||||
if (w->y + w->height <= window->y)
|
||||
continue;
|
||||
window_invalidate(w);
|
||||
cx += 13;
|
||||
if (cx >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16))
|
||||
continue;
|
||||
cx -= 10;
|
||||
cx -= w->x;
|
||||
w->x += cx;
|
||||
window_invalidate(w);
|
||||
if (w->viewport != NULL)
|
||||
w->viewport->x += cx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,6 +469,7 @@ void window_staff_init_vars();
|
||||
|
||||
void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event);
|
||||
void RCT2_CALLPROC_WE_MOUSE_DOWN(int address, int widgetIndex, rct_window*w, rct_widget* widget);
|
||||
void window_move_overlapping(rct_window* window);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define window_get_register(w) \
|
||||
|
||||
@@ -120,7 +120,6 @@ static void window_footpath_tooldrag();
|
||||
static void window_footpath_toolup();
|
||||
static void window_footpath_invalidate();
|
||||
static void window_footpath_paint();
|
||||
static void sub_6EE65A(rct_window* w);
|
||||
|
||||
static void* window_footpath_events[] = {
|
||||
window_footpath_close,
|
||||
@@ -202,7 +201,7 @@ void window_footpath_open()
|
||||
(1 << WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL);
|
||||
|
||||
window_init_scroll_widgets(window);
|
||||
sub_6EE65A(window); //RCT2_CALLPROC_EBPSAFE(0x006EE65A);
|
||||
window_move_overlapping(window);
|
||||
show_gridlines();
|
||||
window->colours[0] = 24;
|
||||
window->colours[1] = 24;
|
||||
@@ -828,36 +827,3 @@ loc_6A79B0:
|
||||
RCT2_CALLPROC_EBPSAFE(0x006A855C);
|
||||
}
|
||||
|
||||
static void sub_6EE65A(rct_window* window)
|
||||
{
|
||||
uint16 ax = window->x;
|
||||
uint16 bx = window->y;
|
||||
uint16 cx = window->width;
|
||||
uint16 dx = window->height;
|
||||
cx += ax;
|
||||
dx += bx;
|
||||
for (rct_window* w = g_window_list; w < RCT2_GLOBAL(RCT2_ADDRESS_NEW_WINDOW_PTR, rct_window*); w++) {
|
||||
if (w == window)
|
||||
continue;
|
||||
if (w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT))
|
||||
continue;
|
||||
if (w->x >= cx)
|
||||
continue;
|
||||
if (w->x + w->width <= ax)
|
||||
continue;
|
||||
if (w->y >= dx)
|
||||
continue;
|
||||
if (w->y + w->height <= bx)
|
||||
continue;
|
||||
window_invalidate(w);
|
||||
cx += 13;
|
||||
if (cx >= RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16))
|
||||
continue;
|
||||
cx -= 10;
|
||||
cx -= w->x;
|
||||
w->x += cx;
|
||||
window_invalidate(w);
|
||||
if (w->viewport != NULL)
|
||||
w->viewport->x += cx;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user