mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Remove window dependency from Ride.cpp
This commit is contained in:
@@ -307,6 +307,24 @@ public:
|
||||
window_maze_construction_update_pressed_widgets();
|
||||
break;
|
||||
|
||||
case INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS:
|
||||
{
|
||||
auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID);
|
||||
auto w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w == nullptr || w->number != rideIndex)
|
||||
{
|
||||
window_close_construction_windows();
|
||||
_currentRideIndex = rideIndex;
|
||||
w = OpenWindow(WC_RIDE_CONSTRUCTION);
|
||||
}
|
||||
else
|
||||
{
|
||||
ride_construction_invalidate_current_track();
|
||||
_currentRideIndex = rideIndex;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES:
|
||||
window_ride_construction_update_enabled_track_pieces();
|
||||
break;
|
||||
@@ -372,6 +390,20 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
case INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE:
|
||||
{
|
||||
auto rideIndex = intent.GetUIntExtra(INTENT_EXTRA_RIDE_ID);
|
||||
auto w = window_find_by_number(WC_RIDE, rideIndex);
|
||||
if (w != nullptr)
|
||||
{
|
||||
if (w->page == 4) // WINDOW_RIDE_PAGE_COLOUR
|
||||
{
|
||||
w->vehicleIndex = 0;
|
||||
}
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
case INTENT_ACTION_UPDATE_CLIMATE:
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "../Game.h"
|
||||
#include "../Input.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../interface/Window_internal.h"
|
||||
#include "../localisation/Date.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../management/Finance.h"
|
||||
@@ -64,6 +63,10 @@
|
||||
#include "TrackData.h"
|
||||
#include "../core/Math.hpp"
|
||||
#include "../core/Util.hpp"
|
||||
#include "../ui/UiContext.h"
|
||||
#include "../ui/WindowManager.h"
|
||||
|
||||
using namespace OpenRCT2;
|
||||
|
||||
#pragma region Ride classification table
|
||||
|
||||
@@ -993,19 +996,11 @@ static sint32 ride_check_if_construction_allowed(Ride *ride)
|
||||
|
||||
static rct_window *ride_create_or_find_construction_window(sint32 rideIndex)
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w == nullptr || w->number != rideIndex) {
|
||||
window_close_construction_windows();
|
||||
_currentRideIndex = rideIndex;
|
||||
w = context_open_window(WC_RIDE_CONSTRUCTION);
|
||||
} else {
|
||||
ride_construction_invalidate_current_track();
|
||||
_currentRideIndex = rideIndex;
|
||||
}
|
||||
|
||||
return w;
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto intent = Intent(INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex);
|
||||
windowManager->BroadcastIntent(intent);
|
||||
return window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -7394,13 +7389,10 @@ static money32 ride_set_vehicles(uint8 rideIndex, uint8 setting, uint8 value, ui
|
||||
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
|
||||
}
|
||||
|
||||
rct_window *w = window_find_by_number(WC_RIDE, rideIndex);
|
||||
if (w != nullptr) {
|
||||
if (w->page == 4) { // WINDOW_RIDE_PAGE_COLOUR
|
||||
w->vehicleIndex = 0;
|
||||
}
|
||||
window_invalidate(w);
|
||||
}
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE);
|
||||
intent.putExtra(INTENT_EXTRA_RIDE_ID, rideIndex);
|
||||
windowManager->BroadcastIntent(intent);
|
||||
|
||||
gfx_invalidate_screen();
|
||||
return 0;
|
||||
|
||||
@@ -81,6 +81,7 @@ enum
|
||||
INTENT_ACTION_REFRESH_NEW_RIDES,
|
||||
INTENT_ACTION_REFRESH_RIDE_LIST,
|
||||
INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION,
|
||||
INTENT_ACTION_RIDE_CONSTRUCTION_FOCUS,
|
||||
INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_PIECES,
|
||||
INTENT_ACTION_RIDE_CONSTRUCTION_UPDATE_ACTIVE_ELEMENTS,
|
||||
INTENT_ACTION_INIT_SCENERY,
|
||||
@@ -91,6 +92,7 @@ enum
|
||||
INTENT_ACTION_CLEAR_TILE_INSPECTOR_CLIPBOARD,
|
||||
INTENT_ACTION_REFRESH_STAFF_LIST,
|
||||
INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW,
|
||||
INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE,
|
||||
INTENT_ACTION_UPDATE_CLIMATE,
|
||||
INTENT_ACTION_UPDATE_GUEST_COUNT,
|
||||
INTENT_ACTION_UPDATE_PARK_RATING,
|
||||
|
||||
Reference in New Issue
Block a user