Fix for Issue#8725: refactoring _currentTrackBegin and _previousTrackPiece to use CoordsXYZ struct (#8759)

* Refactored _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ to use a CoordsXYZ struct

* Refactored _previousTracPieceX, _previousTrackPieceY, _previousTrackPieceZ to use a CoordsXYZ struct

* Refactored _currentTrackBegin and _previousTrackPiece in source files

* Fixed clang formatting
This commit is contained in:
Nathaniel Ngo 2019-02-24 04:15:31 -05:00 committed by Duncan
parent a883a46af1
commit 300fd3a589
5 changed files with 142 additions and 145 deletions

View File

@ -482,9 +482,9 @@ static void window_maze_construction_construct(int32_t direction)
ride_construction_invalidate_current_track();
x = _currentTrackBeginX + (CoordsDirectionDelta[direction].x / 2);
y = _currentTrackBeginY + (CoordsDirectionDelta[direction].y / 2);
z = _currentTrackBeginZ;
x = _currentTrackBegin.x + (CoordsDirectionDelta[direction].x / 2);
y = _currentTrackBegin.y + (CoordsDirectionDelta[direction].y / 2);
z = _currentTrackBegin.z;
switch (_rideConstructionState)
{
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
@ -508,8 +508,8 @@ static void window_maze_construction_construct(int32_t direction)
return;
}
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_MAZE_MOVE)
{
audio_play_sound_at_location(SOUND_PLACE_ITEM, x, y, z);

View File

@ -1680,9 +1680,9 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
if (ride != nullptr)
{
int32_t trackDirection = _currentTrackPieceDirection;
int32_t x = _currentTrackBeginX;
int32_t y = _currentTrackBeginY;
int32_t z = _currentTrackBeginZ;
int32_t x = _currentTrackBegin.x;
int32_t y = _currentTrackBegin.y;
int32_t z = _currentTrackBegin.z;
if (!(trackDirection & 4))
{
x -= CoordsDirectionDelta[trackDirection].x;
@ -1692,9 +1692,9 @@ static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, c
CoordsXYE next_track;
if (track_block_get_next_from_zero(x, y, z, ride, trackDirection, &next_track, &z, &trackDirection, false))
{
_currentTrackBeginX = next_track.x;
_currentTrackBeginY = next_track.y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = next_track.x;
_currentTrackBegin.y = next_track.y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = next_track.element->GetDirection();
_currentTrackPieceType = next_track.element->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1727,9 +1727,9 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
if (ride != nullptr)
{
auto trackDirection = direction_reverse(_currentTrackPieceDirection);
auto x = _currentTrackBeginX;
auto y = _currentTrackBeginY;
auto z = _currentTrackBeginZ;
auto x = _currentTrackBegin.x;
auto y = _currentTrackBegin.y;
auto z = _currentTrackBegin.z;
if (!(trackDirection & 4))
{
x += CoordsDirectionDelta[trackDirection].x;
@ -1739,9 +1739,9 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
track_begin_end trackBeginEnd;
if (track_block_get_previous_from_zero(x, y, z, ride, trackDirection, &trackBeginEnd))
{
_currentTrackBeginX = trackBeginEnd.begin_x;
_currentTrackBeginY = trackBeginEnd.begin_y;
_currentTrackBeginZ = trackBeginEnd.begin_z;
_currentTrackBegin.x = trackBeginEnd.begin_x;
_currentTrackBegin.y = trackBeginEnd.begin_y;
_currentTrackBegin.z = trackBeginEnd.begin_z;
_currentTrackPieceDirection = trackBeginEnd.begin_direction;
_currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1859,9 +1859,9 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
}
// Invalidate the selected track element or make sure it's at origin???
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = _currentTrackPieceDirection;
type = _currentTrackPieceType;
if (sub_6C683D(&x, &y, &z, direction & 3, type, 0, &tileElement, 0))
@ -1893,9 +1893,9 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
}
else
{
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = _currentTrackPieceDirection;
type = _currentTrackPieceType;
@ -1913,7 +1913,7 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
auto trackRemoveAction = TrackRemoveAction(
_currentTrackPieceType, 0,
{ _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ, _currentTrackPieceDirection });
{ _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, _currentTrackPieceDirection });
trackRemoveAction.SetCallback([=](const GameAction* ga, const GameActionResult* result) {
_stationConstructed = get_ride(w->number)->num_stations != 0;
@ -2506,9 +2506,9 @@ void window_ride_construction_update_active_elements_impl()
_selectedTrackType = 255;
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
{
int32_t x = _currentTrackBeginX;
int32_t y = _currentTrackBeginY;
int32_t z = _currentTrackBeginZ;
int32_t x = _currentTrackBegin.x;
int32_t y = _currentTrackBegin.y;
int32_t z = _currentTrackBegin.z;
if (!sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, 0, &tileElement, 0))
{
_selectedTrackType = tileElement->AsTrack()->GetTrackType();
@ -2599,9 +2599,9 @@ void sub_6C94D8()
_rideConstructionArrowPulseTime = 5;
_currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = _currentTrackPieceDirection;
type = _currentTrackPieceType;
gMapSelectArrowPosition.x = x;
@ -2624,9 +2624,9 @@ void sub_6C94D8()
_rideConstructionArrowPulseTime = 5;
_currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = _currentTrackPieceDirection & 3;
type = _currentTrackPieceType;
if (sub_6C683D(
@ -2645,20 +2645,20 @@ void sub_6C94D8()
_rideConstructionArrowPulseTime = 5;
_currentTrackSelectionFlags ^= TRACK_SELECTION_FLAG_ARROW;
x = _currentTrackBeginX & 0xFFE0;
y = _currentTrackBeginY & 0xFFE0;
z = _currentTrackBeginZ + 15;
x = _currentTrackBegin.x & 0xFFE0;
y = _currentTrackBegin.y & 0xFFE0;
z = _currentTrackBegin.z + 15;
gMapSelectArrowPosition.x = x;
gMapSelectArrowPosition.y = y;
gMapSelectArrowPosition.z = z;
gMapSelectArrowDirection = 4;
if (((_currentTrackBeginX & 0x1F) | (_currentTrackBeginY & 0x1F)) != 0)
if (((_currentTrackBegin.x & 0x1F) | (_currentTrackBegin.y & 0x1F)) != 0)
{
gMapSelectArrowDirection = 6;
if (((_currentTrackBeginX & 0x1F) & (_currentTrackBeginY & 0x1F)) == 0)
if (((_currentTrackBegin.x & 0x1F) & (_currentTrackBegin.y & 0x1F)) == 0)
{
gMapSelectArrowDirection = 5;
if ((_currentTrackBeginY & 0x1F) == 0)
if ((_currentTrackBegin.y & 0x1F) == 0)
gMapSelectArrowDirection = 7;
}
}
@ -2688,22 +2688,22 @@ static void window_ride_construction_update_map_selection()
case RIDE_CONSTRUCTION_STATE_0:
trackDirection = _currentTrackPieceDirection;
trackType = 0;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
break;
case RIDE_CONSTRUCTION_STATE_SELECTED:
trackDirection = _currentTrackPieceDirection;
trackType = _currentTrackPieceType;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
break;
default:
if (window_ride_construction_update_state(&trackType, &trackDirection, nullptr, nullptr, &x, &y, nullptr, nullptr))
{
trackDirection = _currentTrackPieceDirection;
trackType = 0;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
}
break;
}
@ -3431,9 +3431,9 @@ static void window_ride_construction_show_special_track_dropdown(rct_window* w,
static void ride_selected_track_set_seat_rotation(int32_t seatRotation)
{
int32_t x, y, z;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, seatRotation, nullptr, (1 << 5));
window_ride_construction_update_active_elements();
}
@ -3465,14 +3465,14 @@ static void ride_construction_set_brakes_speed(int32_t brakesSpeed)
TileElement* tileElement;
int32_t x, y, z;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
if (!sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, 0, &tileElement, 0))
{
game_do_command(
_currentTrackBeginX, GAME_COMMAND_FLAG_APPLY | ((brakesSpeed) << 8), _currentTrackBeginY,
tileElement->AsTrack()->GetTrackType(), GAME_COMMAND_SET_BRAKES_SPEED, _currentTrackBeginZ, 0);
_currentTrackBegin.x, GAME_COMMAND_FLAG_APPLY | ((brakesSpeed) << 8), _currentTrackBegin.y,
tileElement->AsTrack()->GetTrackType(), GAME_COMMAND_SET_BRAKES_SPEED, _currentTrackBegin.z, 0);
}
window_ride_construction_update_active_elements();
}
@ -3565,19 +3565,19 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
gMapSelectArrowPosition.z = z;
bx = 41;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
if ((_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) && x == _previousTrackPieceX && y == _previousTrackPieceY
&& z == _previousTrackPieceZ)
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
if ((_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) && x == _previousTrackPiece.x && y == _previousTrackPiece.y
&& z == _previousTrackPiece.z)
{
map_invalidate_map_selection_tiles();
return;
}
_previousTrackPieceX = x;
_previousTrackPieceY = y;
_previousTrackPieceZ = z;
_previousTrackPiece.x = x;
_previousTrackPiece.y = y;
_previousTrackPiece.z = z;
if (ride->type == RIDE_TYPE_MAZE)
{
for (;;)
@ -3593,12 +3593,12 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
if (bx == 0)
break;
_currentTrackBeginZ -= 8;
if (_currentTrackBeginZ & LOCATION_NULL)
_currentTrackBegin.z -= 8;
if (_currentTrackBegin.z & LOCATION_NULL)
break;
if (bx >= 0)
_currentTrackBeginZ += 16;
_currentTrackBegin.z += 16;
}
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
@ -3620,12 +3620,12 @@ void ride_construction_toolupdate_construct(int32_t screenX, int32_t screenY)
if (bx == 0)
break;
_currentTrackBeginZ -= 8;
if (_currentTrackBeginZ & LOCATION_NULL)
_currentTrackBegin.z -= 8;
if (_currentTrackBegin.z & LOCATION_NULL)
break;
if (bx >= 0)
_currentTrackBeginZ += 16;
_currentTrackBegin.z += 16;
}
if (_autoRotatingShop && _rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE
@ -3817,9 +3817,9 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
for (int32_t zAttempts = 41; zAttempts >= 0; zAttempts--)
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_MAZE_BUILD;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackSelectionFlags = 0;
_rideConstructionArrowPulseTime = 0;
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
@ -3831,7 +3831,7 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
gDisableErrorWindowSound = true;
_trackPlaceCost = maze_set_track(
_currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ, GAME_COMMAND_FLAG_APPLY, true, 0,
_currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, GAME_COMMAND_FLAG_APPLY, true, 0,
_currentRideIndex, GC_SET_MAZE_TRACK_BUILD);
gDisableErrorWindowSound = false;
@ -3867,7 +3867,8 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
else
{
window_close_by_class(WC_ERROR);
audio_play_sound_at_location(SOUND_PLACE_ITEM, _currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ);
audio_play_sound_at_location(
SOUND_PLACE_ITEM, _currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z);
break;
}
}
@ -3877,9 +3878,9 @@ void ride_construction_tooldown_construct(int32_t screenX, int32_t screenY)
for (int32_t zAttempts = 41; zAttempts >= 0; zAttempts--)
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackSelectionFlags = 0;
_rideConstructionArrowPulseTime = 0;
window_ride_construction_update_active_elements();

View File

@ -163,9 +163,9 @@ uint16_t _numCurrentPossibleSpecialTrackPieces;
uint16_t _currentTrackCurve;
uint8_t _rideConstructionState;
ride_id_t _currentRideIndex;
uint16_t _currentTrackBeginX;
uint16_t _currentTrackBeginY;
uint16_t _currentTrackBeginZ;
CoordsXYZ _currentTrackBegin;
uint8_t _currentTrackPieceDirection;
uint8_t _currentTrackPieceType;
uint8_t _currentTrackSelectionFlags;
@ -179,9 +179,7 @@ uint8_t _selectedTrackType;
uint8_t _previousTrackBankEnd;
uint8_t _previousTrackSlopeEnd;
uint16_t _previousTrackPieceX;
uint16_t _previousTrackPieceY;
uint16_t _previousTrackPieceZ;
CoordsXYZ _previousTrackPiece;
uint8_t _currentBrakeSpeed2;
uint8_t _currentSeatRotationAngle;
@ -1507,9 +1505,9 @@ void ride_construction_invalidate_current_track()
switch (_rideConstructionState)
{
case RIDE_CONSTRUCTION_STATE_SELECTED:
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
sub_6C683D(&x, &y, &z, _currentTrackPieceDirection & 3, _currentTrackPieceType, 0, nullptr, 1);
break;
case RIDE_CONSTRUCTION_STATE_MAZE_BUILD:
@ -1517,7 +1515,7 @@ void ride_construction_invalidate_current_track()
case RIDE_CONSTRUCTION_STATE_MAZE_FILL:
if (_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ARROW)
{
map_invalidate_tile_full(_currentTrackBeginX & 0xFFE0, _currentTrackBeginY & 0xFFE0);
map_invalidate_tile_full(_currentTrackBegin.x & 0xFFE0, _currentTrackBegin.y & 0xFFE0);
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
}
break;
@ -1526,7 +1524,7 @@ void ride_construction_invalidate_current_track()
{
_currentTrackSelectionFlags &= ~TRACK_SELECTION_FLAG_ARROW;
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
map_invalidate_tile_full(_currentTrackBeginX, _currentTrackBeginY);
map_invalidate_tile_full(_currentTrackBegin.x, _currentTrackBegin.y);
}
ride_construction_remove_ghosts();
break;
@ -1583,9 +1581,9 @@ void ride_construction_set_default_next_piece()
rideIndex = _currentRideIndex;
ride = get_ride(rideIndex);
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = _currentTrackPieceDirection;
if (!track_block_get_previous_from_zero(x, y, z, ride, direction, &trackBeginEnd))
{
@ -1656,9 +1654,9 @@ void ride_construction_set_default_next_piece()
rideIndex = _currentRideIndex;
ride = get_ride(rideIndex);
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
direction = direction_reverse(_currentTrackPieceDirection);
if (!track_block_get_next_from_zero(x, y, z, ride, direction, &xyElement, &z, &direction, false))
{
@ -1733,9 +1731,9 @@ void ride_select_next_section()
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
{
ride_construction_invalidate_current_track();
int32_t x = _currentTrackBeginX;
int32_t y = _currentTrackBeginY;
int32_t z = _currentTrackBeginZ;
int32_t x = _currentTrackBegin.x;
int32_t y = _currentTrackBegin.y;
int32_t z = _currentTrackBegin.z;
int32_t direction = _currentTrackPieceDirection;
int32_t type = _currentTrackPieceType;
TileElement* tileElement;
@ -1767,9 +1765,9 @@ void ride_select_next_section()
else
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
_currentTrackBeginX = outputElement.x;
_currentTrackBeginY = outputElement.y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = outputElement.x;
_currentTrackBegin.y = outputElement.y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = direction;
_currentTrackPieceType = tileElement->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1779,9 +1777,9 @@ void ride_select_next_section()
return;
}
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = tileElement->GetDirection();
_currentTrackPieceType = tileElement->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1806,9 +1804,9 @@ void ride_select_previous_section()
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_SELECTED)
{
ride_construction_invalidate_current_track();
int32_t x = _currentTrackBeginX;
int32_t y = _currentTrackBeginY;
int32_t z = _currentTrackBeginZ;
int32_t x = _currentTrackBegin.x;
int32_t y = _currentTrackBegin.y;
int32_t z = _currentTrackBegin.z;
int32_t direction = _currentTrackPieceDirection;
int32_t type = _currentTrackPieceType;
TileElement* tileElement;
@ -1825,9 +1823,9 @@ void ride_select_previous_section()
track_begin_end trackBeginEnd;
if (track_block_get_previous(x, y, tileElement, &trackBeginEnd))
{
_currentTrackBeginX = trackBeginEnd.begin_x;
_currentTrackBeginY = trackBeginEnd.begin_y;
_currentTrackBeginZ = trackBeginEnd.begin_z;
_currentTrackBegin.x = trackBeginEnd.begin_x;
_currentTrackBegin.y = trackBeginEnd.begin_y;
_currentTrackBegin.z = trackBeginEnd.begin_z;
_currentTrackPieceDirection = trackBeginEnd.begin_direction;
_currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1842,9 +1840,9 @@ void ride_select_previous_section()
else
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_BACK;
_currentTrackBeginX = trackBeginEnd.end_x;
_currentTrackBeginY = trackBeginEnd.end_y;
_currentTrackBeginZ = trackBeginEnd.begin_z;
_currentTrackBegin.x = trackBeginEnd.end_x;
_currentTrackBegin.y = trackBeginEnd.end_y;
_currentTrackBegin.z = trackBeginEnd.begin_z;
_currentTrackPieceDirection = trackBeginEnd.end_direction;
_currentTrackPieceType = tileElement->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -1937,9 +1935,9 @@ static int32_t ride_modify_maze(TileElement* tileElement, int32_t x, int32_t y)
{
_currentRideIndex = tileElement->AsTrack()->GetRideIndex();
_rideConstructionState = RIDE_CONSTRUCTION_STATE_MAZE_BUILD;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = tileElement->base_height * 8;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = tileElement->base_height * 8;
_currentTrackSelectionFlags = 0;
_rideConstructionArrowPulseTime = 0;
@ -2010,9 +2008,9 @@ int32_t ride_modify(CoordsXYE* input)
_currentRideIndex = rideIndex;
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = direction;
_currentTrackPieceType = type;
_currentTrackSelectionFlags = 0;
@ -2032,9 +2030,9 @@ int32_t ride_modify(CoordsXYE* input)
}
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = direction;
_currentTrackPieceType = type;
_currentTrackSelectionFlags = 0;
@ -2045,9 +2043,9 @@ int32_t ride_modify(CoordsXYE* input)
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_BACK)
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = direction;
_currentTrackPieceType = type;
_currentTrackSelectionFlags = 0;
@ -6869,13 +6867,13 @@ bool ride_select_backwards_from_front()
ride_construction_invalidate_current_track();
track_begin_end trackBeginEnd;
if (track_block_get_previous_from_zero(
_currentTrackBeginX, _currentTrackBeginY, _currentTrackBeginZ, ride, _currentTrackPieceDirection,
_currentTrackBegin.x, _currentTrackBegin.y, _currentTrackBegin.z, ride, _currentTrackPieceDirection,
&trackBeginEnd))
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
_currentTrackBeginX = trackBeginEnd.begin_x;
_currentTrackBeginY = trackBeginEnd.begin_y;
_currentTrackBeginZ = trackBeginEnd.begin_z;
_currentTrackBegin.x = trackBeginEnd.begin_x;
_currentTrackBegin.y = trackBeginEnd.begin_y;
_currentTrackBegin.z = trackBeginEnd.begin_z;
_currentTrackPieceDirection = trackBeginEnd.begin_direction;
_currentTrackPieceType = trackBeginEnd.begin_element->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;
@ -6893,17 +6891,17 @@ bool ride_select_forwards_from_back()
{
ride_construction_invalidate_current_track();
int32_t x = _currentTrackBeginX;
int32_t y = _currentTrackBeginY;
int32_t z = _currentTrackBeginZ;
int32_t x = _currentTrackBegin.x;
int32_t y = _currentTrackBegin.y;
int32_t z = _currentTrackBegin.z;
int32_t direction = direction_reverse(_currentTrackPieceDirection);
CoordsXYE next_track;
if (track_block_get_next_from_zero(x, y, z, ride, direction, &next_track, &z, &direction, false))
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
_currentTrackBeginX = next_track.x;
_currentTrackBeginY = next_track.y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = next_track.x;
_currentTrackBegin.y = next_track.y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = next_track.element->GetDirection();
_currentTrackPieceType = next_track.element->AsTrack()->GetTrackType();
_currentTrackSelectionFlags = 0;

View File

@ -958,9 +958,9 @@ extern uint16_t _numCurrentPossibleSpecialTrackPieces;
extern uint16_t _currentTrackCurve;
extern uint8_t _rideConstructionState;
extern ride_id_t _currentRideIndex;
extern uint16_t _currentTrackBeginX;
extern uint16_t _currentTrackBeginY;
extern uint16_t _currentTrackBeginZ;
extern CoordsXYZ _currentTrackBegin;
extern uint8_t _currentTrackPieceDirection;
extern uint8_t _currentTrackPieceType;
extern uint8_t _currentTrackSelectionFlags;
@ -974,9 +974,7 @@ extern uint8_t _selectedTrackType;
extern uint8_t _previousTrackBankEnd;
extern uint8_t _previousTrackSlopeEnd;
extern uint16_t _previousTrackPieceX;
extern uint16_t _previousTrackPieceY;
extern uint16_t _previousTrackPieceZ;
extern CoordsXYZ _previousTrackPiece;
extern uint8_t _currentBrakeSpeed2;
extern uint8_t _currentSeatRotationAngle;

View File

@ -412,9 +412,9 @@ bool window_ride_construction_update_state(
const rct_track_coordinates* trackCoordinates = get_track_coord_from_ride(ride, trackType);
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
x = _currentTrackBegin.x;
y = _currentTrackBegin.y;
z = _currentTrackBegin.z;
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK)
{
z -= trackCoordinates->z_end;
@ -552,7 +552,7 @@ void window_ride_construction_mouseup_demolish_next_piece(int32_t x, int32_t y,
if (gGotoStartPlacementMode)
{
z &= 0xFFF0;
_currentTrackBeginZ = z;
_currentTrackBegin.z = z;
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
_currentTrackSelectionFlags = 0;
_rideConstructionArrowPulseTime = 0;
@ -606,9 +606,9 @@ void window_ride_construction_mouseup_demolish_next_piece(int32_t x, int32_t y,
// rideConstructionState needs to be set again to the proper value, this only affects the client
_rideConstructionState = RIDE_CONSTRUCTION_STATE_SELECTED;
}
_currentTrackBeginX = x;
_currentTrackBeginY = y;
_currentTrackBeginZ = z;
_currentTrackBegin.x = x;
_currentTrackBegin.y = y;
_currentTrackBegin.z = z;
_currentTrackPieceDirection = direction;
_currentTrackPieceType = type;
_currentTrackSelectionFlags = 0;