diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index a8a0949a4e..355c3647ec 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -144,6 +144,8 @@ public: { return window_new_ride_open_research(); } + case WV_MAZE_CONSTRUCTION: + return window_maze_construction_open(); default: return nullptr; } @@ -260,6 +262,10 @@ public: break; } + + case INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION: + window_maze_construction_update_pressed_widgets(); + break; } } diff --git a/src/openrct2/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp similarity index 97% rename from src/openrct2/windows/MazeConstruction.cpp rename to src/openrct2-ui/windows/MazeConstruction.cpp index edfbdc947c..ea35b7dc56 100644 --- a/src/openrct2/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -14,17 +14,19 @@ *****************************************************************************/ #pragma endregion -#include "../audio/audio.h" -#include "../drawing/drawing.h" -#include "../game.h" -#include "../input.h" -#include "../interface/viewport.h" -#include "../interface/widget.h" -#include "../localisation/localisation.h" -#include "../ride/Track.h" -#include "../sprites.h" -#include "Intent.h" -#include "../Context.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #pragma region Widgets diff --git a/src/openrct2-ui/windows/Window.h b/src/openrct2-ui/windows/Window.h index 8b5f06eece..a7cb22d81d 100644 --- a/src/openrct2-ui/windows/Window.h +++ b/src/openrct2-ui/windows/Window.h @@ -118,3 +118,6 @@ extern ride_list_item _window_track_list_item; rct_window * window_track_list_open(ride_list_item item); void window_map_tooltip_update_visibility(); + +rct_window * window_maze_construction_open(); +void window_maze_construction_update_pressed_widgets(); diff --git a/src/openrct2/interface/window.h b/src/openrct2/interface/window.h index a2a633987b..8014a4a1d5 100644 --- a/src/openrct2/interface/window.h +++ b/src/openrct2/interface/window.h @@ -507,7 +507,7 @@ enum { WV_PARK_GUESTS, WV_FINANCES_RESEARCH, WV_RIDE_RESEARCH, - + WV_MAZE_CONSTRUCTION, }; enum { @@ -718,13 +718,11 @@ void window_game_bottom_toolbar_open(); void window_game_bottom_toolbar_invalidate_news_item(); void window_ride_construct(rct_window *w); rct_window *window_ride_construction_open(); -rct_window *window_maze_construction_open(); void ride_construction_toolupdate_entrance_exit(sint32 screenX, sint32 screenY); void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY); void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY); -void window_maze_construction_update_pressed_widgets(); void window_network_status_open(const char* text, close_callback onClose); void window_network_status_close(); void window_network_status_open_password(); diff --git a/src/openrct2/ride/ride.c b/src/openrct2/ride/ride.c index 9130e6fd21..acf60a7d9e 100644 --- a/src/openrct2/ride/ride.c +++ b/src/openrct2/ride/ride.c @@ -1801,7 +1801,11 @@ static sint32 ride_modify_maze(rct_tile_element *tileElement, sint32 x, sint32 y _currentTrackBeginZ = tileElement->base_height * 8; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - window_maze_construction_update_pressed_widgets(); + + Intent * intent = intent_create(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + context_broadcast_intent(intent); + intent_release(intent); + return 1; } diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index aef31f8ea6..01fa489de9 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -69,6 +69,7 @@ extern "C" { INTENT_ACTION_NEW_RIDE_OF_TYPE, INTENT_ACTION_REFRESH_NEW_RIDES, INTENT_ACTION_REFRESH_RIDE_LIST, + INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION, }; Intent *intent_create(rct_windowclass clss); diff --git a/src/openrct2/windows/RideConstruction.cpp b/src/openrct2/windows/RideConstruction.cpp index 083d27128d..3ad4ce9cbc 100644 --- a/src/openrct2/windows/RideConstruction.cpp +++ b/src/openrct2/windows/RideConstruction.cpp @@ -549,7 +549,9 @@ rct_window *window_ride_construction_open() _deferClose = false; if (ride->type == RIDE_TYPE_MAZE) - return window_maze_construction_open(); + { + return context_open_window_view(WV_MAZE_CONSTRUCTION); + } w = window_create(0, 29, 166, 394, &window_ride_construction_events, WC_RIDE_CONSTRUCTION, WF_NO_AUTO_CLOSE); @@ -3755,7 +3757,8 @@ void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY) _currentTrackBeginZ += 16; } - window_maze_construction_update_pressed_widgets(); + auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + context_broadcast_intent(&intent); map_invalidate_map_selection_tiles(); return; } @@ -3902,7 +3905,8 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) _currentTrackBeginZ = z; _currentTrackSelectionFlags = 0; _rideConstructionArrowPulseTime = 0; - window_maze_construction_update_pressed_widgets(); + auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + context_broadcast_intent(&intent); w = window_find_by_class(WC_RIDE_CONSTRUCTION); if (w == nullptr) break; @@ -3942,7 +3946,8 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY) _trackPlaceCtrlState = false; _trackPlaceShiftState = false; } - window_maze_construction_update_pressed_widgets(); + auto intent2 = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); + context_broadcast_intent(&intent2); break; } else if (zAttempts >= 0) {