From bc413fede97db2354944913b34e6f9ac4078f847 Mon Sep 17 00:00:00 2001 From: ZedThree Date: Fri, 9 May 2014 18:27:59 +0200 Subject: [PATCH] Add helper function for calling widget events Add window_event_helper --- src/window.c | 9 +++++++++ src/window.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/window.c b/src/window.c index 9ce9708cdf..f41a874ff6 100644 --- a/src/window.c +++ b/src/window.c @@ -1245,3 +1245,12 @@ void window_guest_list_init_vars_b() { RCT2_GLOBAL(RCT2_ADDRESS_WINDOW_GUEST_LIST_SELECTED_FILTER, uint8) = 0xFF; RCT2_GLOBAL(0x00F1AF20, uint16) = 0; } + +/** + * Wrapper for window events so C functions can call them + */ +void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event) { + + RCT2_CALLPROC_X(w->event_handlers[event], 0, 0, 0, widgetIndex, w, 0, 0); + +} diff --git a/src/window.h b/src/window.h index a9dad108d6..faa40a5878 100644 --- a/src/window.h +++ b/src/window.h @@ -360,4 +360,6 @@ void window_ride_construction_init_vars(); void window_staff_init_vars(); +void window_event_helper(rct_window* w, short widgetIndex, WINDOW_EVENTS event); + #endif