1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Use ScreenCoordsXY on windows/Ride.cpp

This commit is contained in:
Tulio Leao
2020-05-01 12:58:10 -03:00
parent 0c51528425
commit 9299228f07

View File

@@ -4407,7 +4407,7 @@ static int32_t window_ride_has_track_colour(Ride* ride, int32_t trackColour)
} }
} }
static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_t y) static void window_ride_set_track_colour_scheme(rct_window* w, const ScreenCoordsXY& screenPos)
{ {
TileElement* tileElement; TileElement* tileElement;
uint8_t newColourScheme; uint8_t newColourScheme;
@@ -4416,9 +4416,7 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_
newColourScheme = static_cast<uint8_t>(w->ride_colour); newColourScheme = static_cast<uint8_t>(w->ride_colour);
CoordsXY mapCoord = {}; CoordsXY mapCoord = {};
get_map_coordinates_from_pos({ x, y }, VIEWPORT_INTERACTION_MASK_RIDE, mapCoord, &interactionType, &tileElement, nullptr); get_map_coordinates_from_pos(screenPos, VIEWPORT_INTERACTION_MASK_RIDE, mapCoord, &interactionType, &tileElement, nullptr);
x = mapCoord.x;
y = mapCoord.y;
if (interactionType != VIEWPORT_INTERACTION_ITEM_RIDE) if (interactionType != VIEWPORT_INTERACTION_ITEM_RIDE)
return; return;
@@ -4432,7 +4430,7 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_
z = tileElement->GetBaseZ(); z = tileElement->GetBaseZ();
direction = tileElement->GetDirection(); direction = tileElement->GetDirection();
auto gameAction = RideSetColourSchemeAction( auto gameAction = RideSetColourSchemeAction(
CoordsXYZD{ x, y, z, static_cast<Direction>(direction) }, tileElement->AsTrack()->GetTrackType(), newColourScheme); CoordsXYZD{ mapCoord, z, static_cast<Direction>(direction) }, tileElement->AsTrack()->GetTrackType(), newColourScheme);
GameActions::Execute(&gameAction); GameActions::Execute(&gameAction);
} }
@@ -4749,7 +4747,7 @@ static void window_ride_colour_update(rct_window* w)
static void window_ride_colour_tooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) static void window_ride_colour_tooldown(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
{ {
if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA)
window_ride_set_track_colour_scheme(w, screenCoords.x, screenCoords.y); window_ride_set_track_colour_scheme(w, screenCoords);
} }
/** /**
@@ -4759,7 +4757,7 @@ static void window_ride_colour_tooldown(rct_window* w, rct_widgetindex widgetInd
static void window_ride_colour_tooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords) static void window_ride_colour_tooldrag(rct_window* w, rct_widgetindex widgetIndex, const ScreenCoordsXY& screenCoords)
{ {
if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA) if (widgetIndex == WIDX_PAINT_INDIVIDUAL_AREA)
window_ride_set_track_colour_scheme(w, screenCoords.x, screenCoords.y); window_ride_set_track_colour_scheme(w, screenCoords);
} }
/** /**