mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 08:45:00 +01:00
Refactor RideSetColourSchemeAction
This commit is contained in:
@@ -4349,7 +4349,8 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_
|
||||
|
||||
z = tileElement->base_height * 8;
|
||||
direction = tileElement->GetDirection();
|
||||
auto gameAction = RideSetColourSchemeAction(x, y, z, direction, tileElement->AsTrack()->GetTrackType(), newColourScheme);
|
||||
auto gameAction = RideSetColourSchemeAction( { x, y, z, (Direction)direction}
|
||||
, tileElement->AsTrack()->GetTrackType(), newColourScheme);
|
||||
GameActions::Execute(&gameAction);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,16 +24,14 @@
|
||||
DEFINE_GAME_ACTION(RideSetColourSchemeAction, GAME_COMMAND_SET_COLOUR_SCHEME, GameActionResult)
|
||||
{
|
||||
private:
|
||||
int32_t _x = 0, _y = 0, _z = 0, _direction = 0, _trackType = 0;
|
||||
CoordsXYZD _loc{0,0,0,0};
|
||||
int32_t _trackType = 0;
|
||||
uint16_t _newColourScheme = 0;
|
||||
|
||||
public:
|
||||
RideSetColourSchemeAction() = default;
|
||||
RideSetColourSchemeAction(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t trackType, uint16_t newColourScheme)
|
||||
: _x(x)
|
||||
, _y(y)
|
||||
, _z(z)
|
||||
, _direction(direction)
|
||||
RideSetColourSchemeAction(CoordsXYZD location, int32_t trackType, uint16_t newColourScheme)
|
||||
: _loc(location)
|
||||
, _trackType(trackType)
|
||||
, _newColourScheme(newColourScheme)
|
||||
{
|
||||
@@ -48,8 +46,7 @@ public:
|
||||
{
|
||||
GameAction::Serialise(stream);
|
||||
|
||||
stream << DS_TAG(_x) << DS_TAG(_y) << DS_TAG(_z) << DS_TAG(_direction) << DS_TAG(_trackType)
|
||||
<< DS_TAG(_newColourScheme);
|
||||
stream << DS_TAG(_loc) << DS_TAG(_trackType) << DS_TAG(_newColourScheme);
|
||||
}
|
||||
|
||||
GameActionResult::Ptr Query() const override
|
||||
@@ -63,8 +60,8 @@ public:
|
||||
res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION;
|
||||
res->ErrorTitle = STR_CANT_SET_COLOUR_SCHEME;
|
||||
|
||||
int32_t x = _x, y = _y, z = _z;
|
||||
sub_6C683D(&x, &y, &z, _direction, _trackType, _newColourScheme, nullptr, 4);
|
||||
int32_t x = _loc.x, y = _loc.y, z = _loc.z;
|
||||
sub_6C683D(&x, &y, &z, _loc.direction, _trackType, _newColourScheme, nullptr, 4);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user