From 5f438535adc468170d2c59c9cbb41eade47ec61b Mon Sep 17 00:00:00 2001 From: frutiemax Date: Fri, 27 Aug 2021 17:49:32 -0400 Subject: [PATCH] Part of #13874: Gymnasiast review --- src/openrct2-ui/windows/NewRide.cpp | 6 +- src/openrct2-ui/windows/Ride.cpp | 4 +- src/openrct2-ui/windows/RideConstruction.cpp | 24 +++---- src/openrct2-ui/windows/TrackDesignPlace.cpp | 11 ++- src/openrct2/actions/MazePlaceTrackAction.cpp | 8 +-- src/openrct2/actions/MazeSetTrackAction.cpp | 8 +-- src/openrct2/actions/TrackPlaceAction.cpp | 36 +++++----- src/openrct2/actions/TrackRemoveAction.cpp | 20 +++--- src/openrct2/actions/WallPlaceAction.cpp | 24 +++---- src/openrct2/ride/Ride.cpp | 70 +++++++++---------- src/openrct2/ride/RideConstruction.cpp | 40 +++++------ src/openrct2/ride/TrackDesign.cpp | 26 +++---- src/openrct2/ride/TrackPaint.cpp | 4 +- src/openrct2/ride/Vehicle.cpp | 28 ++++---- src/openrct2/windows/_legacy.cpp | 16 ++--- src/openrct2/world/Footpath.cpp | 18 ++--- src/openrct2/world/TileInspector.cpp | 12 ++-- 17 files changed, 177 insertions(+), 178 deletions(-) diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index 0e4868a487..dff60eaa81 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -943,10 +943,10 @@ static void window_new_ride_paint_ride_information( if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { // Get price of ride - int32_t unk2 = GetRideTypeDescriptor(item.Type).StartTrackPiece; + int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece; money64 price = GetRideTypeDescriptor(item.Type).BuildCosts.TrackPrice; - const auto& teDescriptor = GetTrackElementDescriptor(unk2); - price *= teDescriptor.Pricing; + const auto& ted = GetTrackElementDescriptor(startPieceId); + price *= ted.Pricing; price = (price >> 17) * 10 * GetRideTypeDescriptor(item.Type).BuildCosts.PriceEstimateMultiplier; // diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 5fc066517d..7469bce3dc 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -1369,8 +1369,8 @@ rct_window* window_ride_open_track(TileElement* tileElement) // Open ride window in station view auto trackElement = tileElement->AsTrack(); auto trackType = trackElement->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) { auto stationIndex = trackElement->GetStationIndex(); return window_ride_open_station(ride, stationIndex); diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 660e44d6b9..00f1eaa72b 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -1926,8 +1926,8 @@ static void window_ride_construction_mouseup_demolish(rct_window* w) return; } - const auto& teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + const rct_preview_track* trackBlock = ted.Block; newCoords->z = (tileElement->GetBaseZ()) - trackBlock->z; gGotoStartPlacementMode = true; } @@ -2348,8 +2348,8 @@ static void window_ride_construction_draw_track_piece( if (ride == nullptr) return; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const auto* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const auto* trackBlock = ted.Block; while ((trackBlock + 1)->index != 0xFF) trackBlock++; @@ -2403,8 +2403,8 @@ static void sub_6CBCE2( gMapSize = MAXIMUM_MAP_SIZE_TECHNICAL; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const auto* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const auto* trackBlock = ted.Block; while (trackBlock->index != 255) { auto quarterTile = trackBlock->var_08.Rotate(trackDirection); @@ -3297,8 +3297,8 @@ static void window_ride_construction_select_map_tiles( const rct_preview_track* trackBlock; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + trackBlock = ted.Block; trackDirection &= 3; gMapSelectionTiles.clear(); while (trackBlock->index != 255) @@ -3475,8 +3475,8 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) // z = map_get_highest_z(x >> 5, y >> 5); } // loc_6CC91B: - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + trackBlock = ted.Block; int32_t bx = 0; do { @@ -3706,8 +3706,8 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) if (_trackPlaceZ == 0) { - const auto& teDescriptor = GetTrackElementDescriptor(_currentTrackPieceType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(_currentTrackPieceType); + const rct_preview_track* trackBlock = ted.Block; int32_t bx = 0; do { diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 3ca11449c2..26d46164af 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -551,8 +551,8 @@ static void window_track_place_draw_mini_preview_track( } // Follow a single track piece shape - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_preview_track* trackBlock = ted.Block; while (trackBlock->index != 255) { auto rotatedAndOffsetTrackBlock = curTrackStart + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(curTrackRotation); @@ -574,9 +574,8 @@ static void window_track_place_draw_mini_preview_track( auto bits = trackBlock->var_08.Rotate(curTrackRotation & 3).GetBaseQuarterOccupied(); // Station track is a lighter colour - uint8_t colour = (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) - ? _PaletteIndexColourStation - : _PaletteIndexColourTrack; + uint8_t colour = (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) ? _PaletteIndexColourStation + : _PaletteIndexColourTrack; for (int32_t i = 0; i < 4; i++) { @@ -597,7 +596,7 @@ static void window_track_place_draw_mini_preview_track( // Change rotation and next position based on track curvature curTrackRotation &= 3; - const rct_track_coordinates* track_coordinate = &teDescriptor.Coordinates; + const rct_track_coordinates* track_coordinate = &ted.Coordinates; curTrackStart += CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(curTrackRotation); curTrackRotation += track_coordinate->rotation_end - track_coordinate->rotation_begin; diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp index 8e049bcd13..c39f19a21b 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.cpp +++ b/src/openrct2/actions/MazePlaceTrackAction.cpp @@ -115,8 +115,8 @@ GameActions::Result::Ptr MazePlaceTrackAction::Query() const return res; } - const auto& teDescriptor = GetTrackElementDescriptor(TrackElemType::Maze); - money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * teDescriptor.Pricing) >> 16)); + const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); + money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16)); res->Cost = canBuild->Cost + price / 2 * 10; return res; @@ -157,8 +157,8 @@ GameActions::Result::Ptr MazePlaceTrackAction::Execute() const return canBuild; } - const auto& teDescriptor = GetTrackElementDescriptor(TrackElemType::Maze); - money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * teDescriptor.Pricing) >> 16)); + const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); + money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16)); res->Cost = canBuild->Cost + price / 2 * 10; auto startLoc = _loc.ToTileStart(); diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index f7f78114c3..167f67e1fd 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -136,8 +136,8 @@ GameActions::Result::Ptr MazeSetTrackAction::Query() const return res; } - const auto& teDescriptor = GetTrackElementDescriptor(TrackElemType::Maze); - money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * teDescriptor.Pricing) >> 16)); + const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); + money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16)); res->Cost = price / 2 * 10; return res; @@ -172,8 +172,8 @@ GameActions::Result::Ptr MazeSetTrackAction::Execute() const auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TrackElemType::Maze, _rideIndex); if (tileElement == nullptr) { - const auto& teDescriptor = GetTrackElementDescriptor(TrackElemType::Maze); - money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * teDescriptor.Pricing) >> 16)); + const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); + money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16)); res->Cost = price / 2 * 10; auto startLoc = _loc.ToTileStart(); diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 21131a1c3c..96aab983f4 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -147,8 +147,8 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const if ((_trackPlaceFlags & CONSTRUCTION_LIFT_HILL_SELECTED) && !ride->GetRideTypeDescriptor().SupportsTrackPiece(TRACK_LIFT_HILL_STEEP) && !gCheatsEnableChainLiftOnAllTrack) { - const auto& teDescriptor = GetTrackElementDescriptor(_trackType); - if (teDescriptor.Flags & TRACK_ELEM_FLAG_IS_STEEP_UP) + const auto& ted = GetTrackElementDescriptor(_trackType); + if (ted.Flags & TRACK_ELEM_FLAG_IS_STEEP_UP) { return std::make_unique(GameActions::Status::Disallowed, STR_TOO_STEEP_FOR_LIFT_HILL); } @@ -156,8 +156,8 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } money32 cost = 0; - const auto& teDescriptor = GetTrackElementDescriptor(_trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(_trackType); + const rct_preview_track* trackBlock = ted.Block; uint32_t numElements = 0; // First check if any of the track pieces are outside the park for (; trackBlock->index != 0xFF; trackBlock++) @@ -180,7 +180,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const if (!gCheatsAllowTrackPlaceInvalidHeights) { - if (teDescriptor.Flags & TRACK_ELEM_FLAG_STARTS_AT_HALF_HEIGHT) + if (ted.Flags & TRACK_ELEM_FLAG_STARTS_AT_HALF_HEIGHT) { if ((_origin.z & 0x0F) != 8) { @@ -199,7 +199,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } // If that is not the case, then perform the remaining checks - trackBlock = teDescriptor.Block; + trackBlock = ted.Block; for (int32_t blockIndex = 0; trackBlock->index != 0xFF; trackBlock++, blockIndex++) { @@ -263,7 +263,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } res->GroundFlags = mapGroundFlags; - if (teDescriptor.Flags & TRACK_ELEM_FLAG_ONLY_ABOVE_GROUND) + if (ted.Flags & TRACK_ELEM_FLAG_ONLY_ABOVE_GROUND) { if (res->GroundFlags & ELEMENT_IS_UNDERGROUND) { @@ -272,7 +272,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } } - if (teDescriptor.Flags & TRACK_ELEM_FLAG_ONLY_UNDERWATER) + if (ted.Flags & TRACK_ELEM_FLAG_ONLY_UNDERWATER) { // No element has this flag if (canBuild->GroundFlags & ELEMENT_IS_UNDERWATER) { @@ -318,7 +318,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } } - int32_t entranceDirections = teDescriptor.TrackSequenceProperties[0]; + int32_t entranceDirections = ted.TrackSequenceProperties[0]; if ((entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN) && trackBlock->index == 0) { if (!track_add_station_element({ mapLoc, baseZ, _origin.direction }, _rideIndex, 0, _fromTrackDesign)) @@ -367,7 +367,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const } money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice; - price *= teDescriptor.Pricing; + price *= ted.Pricing; price >>= 16; res->Cost = cost + ((price / 2) * 10); @@ -400,11 +400,11 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const uint32_t rideTypeFlags = ride->GetRideTypeDescriptor().Flags; - const auto& teDescriptor = GetTrackElementDescriptor(_trackType); - auto wallEdges = teDescriptor.SequenceElementAllowedWallEdges; + const auto& ted = GetTrackElementDescriptor(_trackType); + auto wallEdges = ted.SequenceElementAllowedWallEdges; money32 cost = 0; - const rct_preview_track* trackBlock = teDescriptor.Block; + const rct_preview_track* trackBlock = ted.Block; for (int32_t blockIndex = 0; trackBlock->index != 0xFF; trackBlock++, blockIndex++) { auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(_origin.direction), trackBlock->z }; @@ -538,7 +538,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const { if (!(GetFlags() & GAME_COMMAND_FLAG_NO_SPEND)) { - entranceDirections = teDescriptor.TrackSequenceProperties[0]; + entranceDirections = ted.TrackSequenceProperties[0]; } } @@ -597,7 +597,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const } trackElement->SetColourScheme(_colour); - entranceDirections = teDescriptor.TrackSequenceProperties[0]; + entranceDirections = ted.TrackSequenceProperties[0]; if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH) { uint8_t availableDirections = entranceDirections & 0x0F; @@ -653,7 +653,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const } money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice; - price *= teDescriptor.Pricing; + price *= ted.Pricing; price >>= 16; res->Cost = cost + ((price / 2) * 10); @@ -662,8 +662,8 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const bool TrackPlaceAction::CheckMapCapacity(int16_t numTiles) const { - const auto& teDescriptor = GetTrackElementDescriptor(_trackType); - for (const rct_preview_track* trackBlock = teDescriptor.Block; trackBlock->index != 0xFF; trackBlock++) + const auto& ted = GetTrackElementDescriptor(_trackType); + for (const rct_preview_track* trackBlock = ted.Block; trackBlock->index != 0xFF; trackBlock++) { auto rotatedTrack = CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(_origin.direction); diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index 5e084b109d..49e9967d05 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -136,8 +136,8 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const log_warning("Ride type not found. ride type = %d.", ride->type); return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS); } - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_preview_track* trackBlock = ted.Block; trackBlock += tileElement->AsTrack()->GetSequenceIndex(); auto startLoc = _origin; @@ -153,7 +153,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const money32 cost = 0; - trackBlock = teDescriptor.Block; + trackBlock = ted.Block; for (; trackBlock->index != 255; trackBlock++) { rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(startLoc.direction), trackBlock->z }; @@ -203,7 +203,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS); } - int32_t entranceDirections = teDescriptor.TrackSequenceProperties[0]; + int32_t entranceDirections = ted.TrackSequenceProperties[0]; if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && (tileElement->AsTrack()->GetSequenceIndex() == 0)) { if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0)) @@ -229,7 +229,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const } money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice; - price *= teDescriptor.Pricing; + price *= ted.Pricing; price >>= 16; price = (price + cost) / 2; if (ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED) @@ -317,8 +317,8 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const log_warning("Ride not found. ride index = %d.", rideIndex); return MakeResult(GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS); } - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_preview_track* trackBlock = ted.Block; trackBlock += tileElement->AsTrack()->GetSequenceIndex(); auto startLoc = _origin; @@ -333,7 +333,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const res->Position.z = startLoc.z; money32 cost = 0; - trackBlock = teDescriptor.Block; + trackBlock = ted.Block; for (; trackBlock->index != 255; trackBlock++) { rotatedTrackLoc = CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(startLoc.direction), trackBlock->z }; @@ -378,7 +378,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS); } - int32_t entranceDirections = teDescriptor.TrackSequenceProperties[0]; + int32_t entranceDirections = ted.TrackSequenceProperties[0]; if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && (tileElement->AsTrack()->GetSequenceIndex() == 0)) { if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0)) @@ -477,7 +477,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const } money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice; - price *= teDescriptor.Pricing; + price *= ted.Pricing; price >>= 16; price = (price + cost) / 2; if (ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED) diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 7aa2244383..2f660ea596 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -408,7 +408,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( track_type_t trackType = trackElement->GetTrackType(); using namespace OpenRCT2::TrackMetaData; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); + const auto& ted = GetTrackElementDescriptor(trackType); int32_t sequence = trackElement->GetSequenceIndex(); int32_t direction = (_edge - trackElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK; auto ride = get_ride(trackElement->GetRideIndex()); @@ -441,20 +441,20 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( int32_t z; if (sequence == 0) { - if (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS) + if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS) { return false; } if (TrackDefinitions[trackType].bank_start == 0) { - if (!(teDescriptor.Coordinates.rotation_begin & 4)) + if (!(ted.Coordinates.rotation_begin & 4)) { direction = direction_reverse(trackElement->GetDirection()); if (direction == _edge) { - const rct_preview_track* trackBlock = &teDescriptor.Block[sequence]; - z = teDescriptor.Coordinates.z_begin; + const rct_preview_track* trackBlock = &ted.Block[sequence]; + z = ted.Coordinates.z_begin; z = trackElement->base_height + ((z - trackBlock->z) * 8); if (z == z0) { @@ -465,7 +465,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( } } - const rct_preview_track* trackBlock = &teDescriptor.Block[sequence + 1]; + const rct_preview_track* trackBlock = &ted.Block[sequence + 1]; if (trackBlock->index != 0xFF) { return false; @@ -476,20 +476,20 @@ bool WallPlaceAction::WallCheckObstructionWithTrack( return false; } - direction = teDescriptor.Coordinates.rotation_end; + direction = ted.Coordinates.rotation_end; if (direction & 4) { return false; } - direction = (trackElement->GetDirection() + teDescriptor.Coordinates.rotation_end) & TILE_ELEMENT_DIRECTION_MASK; + direction = (trackElement->GetDirection() + ted.Coordinates.rotation_end) & TILE_ELEMENT_DIRECTION_MASK; if (direction != _edge) { return false; } - trackBlock = &teDescriptor.Block[sequence]; - z = teDescriptor.Coordinates.z_end; + trackBlock = &ted.Block[sequence]; + z = ted.Coordinates.z_end; z = trackElement->base_height + ((z - trackBlock->z) * 8); return z == z0; } @@ -593,8 +593,8 @@ bool WallPlaceAction::TrackIsAllowedWallEdges( { if (!GetRideTypeDescriptor(rideType).HasFlag(RIDE_TYPE_FLAG_TRACK_NO_WALLS)) { - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.SequenceElementAllowedWallEdges[trackSequence] & (1 << direction)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.SequenceElementAllowedWallEdges[trackSequence] & (1 << direction)) { return true; } diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b3df84e1bc..877be528eb 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -410,11 +410,11 @@ bool ride_try_get_origin_element(const Ride* ride, CoordsXYE* output) // Found a track piece for target ride // Check if it's not the station or ??? (but allow end piece of station) - const auto& teDescriptor = GetTrackElementDescriptor(it.element->AsTrack()->GetTrackType()); + const auto& ted = GetTrackElementDescriptor(it.element->AsTrack()->GetTrackType()); bool specialTrackPiece = (it.element->AsTrack()->GetTrackType() != TrackElemType::BeginStation && it.element->AsTrack()->GetTrackType() != TrackElemType::MiddleStation - && (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)); + && (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)); // Set result tile to this track piece if first found track or a ??? if (resultTileElement == nullptr || specialTrackPiece) @@ -480,12 +480,12 @@ bool track_block_get_next_from_zero( if (tileElement->IsGhost() != isGhost) continue; - const auto& teDescriptor = GetTrackElementDescriptor(trackElement->GetTrackType()); - auto nextTrackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType()); + auto nextTrackBlock = ted.Block; if (nextTrackBlock == nullptr) continue; - auto nextTrackCoordinate = teDescriptor.Coordinates; + auto nextTrackCoordinate = ted.Coordinates; uint8_t nextRotation = tileElement->GetDirectionWithOffset(nextTrackCoordinate.rotation_begin) | (nextTrackCoordinate.rotation_begin & TRACK_BLOCK_2); @@ -522,7 +522,7 @@ bool track_block_get_next(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32 return false; auto inputElement = input->element->AsTrack(); - const auto& teDescriptor = GetTrackElementDescriptor(inputElement->GetTrackType()); + const auto& ted = GetTrackElementDescriptor(inputElement->GetTrackType()); if (inputElement == nullptr) return false; @@ -531,13 +531,13 @@ bool track_block_get_next(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32 if (ride == nullptr) return false; - const auto* trackBlock = teDescriptor.Block; + const auto* trackBlock = ted.Block; if (trackBlock == nullptr) return false; trackBlock += inputElement->GetSequenceIndex(); - auto trackCoordinate = teDescriptor.Coordinates; + auto trackCoordinate = ted.Coordinates; int32_t x = input->x; int32_t y = input->y; @@ -635,8 +635,8 @@ bool track_block_get_previous_from_zero( outTrackBeginEnd->begin_z = tileElement->GetBaseZ(); - const auto& teDescriptor = GetTrackElementDescriptor(trackElement->GetTrackType()); - const auto* nextTrackBlock2 = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType()); + const auto* nextTrackBlock2 = ted.Block; if (nextTrackBlock2 == nullptr) continue; @@ -668,7 +668,7 @@ bool track_block_get_previous(const CoordsXYE& trackPos, track_begin_end* outTra return false; auto trackElement = trackPos.element->AsTrack(); - const auto& teDescriptor = GetTrackElementDescriptor(trackElement->GetTrackType()); + const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType()); if (trackElement == nullptr) return false; @@ -677,13 +677,13 @@ bool track_block_get_previous(const CoordsXYE& trackPos, track_begin_end* outTra if (ride == nullptr) return false; - const auto* trackBlock = teDescriptor.Block; + const auto* trackBlock = ted.Block; if (trackBlock == nullptr) return false; trackBlock += trackElement->GetSequenceIndex(); - auto trackCoordinate = teDescriptor.Coordinates; + auto trackCoordinate = ted.Coordinates; int32_t z = trackElement->GetBaseZ(); @@ -2229,8 +2229,8 @@ static void ride_shop_connected(Ride* ride) return; } - const auto& teDescriptor = GetTrackElementDescriptor(track_type); - uint8_t entrance_directions = teDescriptor.TrackSequenceProperties[0] & 0xF; + const auto& ted = GetTrackElementDescriptor(track_type); + uint8_t entrance_directions = ted.TrackSequenceProperties[0] & 0xF; uint8_t tile_direction = trackElement->GetDirection(); entrance_directions = rol4(entrance_directions, tile_direction); @@ -2665,8 +2665,8 @@ static bool ride_check_track_contains_inversions(CoordsXYE* input, CoordsXYE* ou while (track_circuit_iterator_next(&it)) { auto trackType = it.current.element->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.Flags & TRACK_ELEM_FLAG_INVERSION_TO_NORMAL) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.Flags & TRACK_ELEM_FLAG_INVERSION_TO_NORMAL) { *output = it.current; return true; @@ -2724,8 +2724,8 @@ static bool ride_check_track_contains_banked(CoordsXYE* input, CoordsXYE* output while (track_circuit_iterator_next(&it)) { auto trackType = output->element->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.Flags & TRACK_ELEM_FLAG_BANKED) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.Flags & TRACK_ELEM_FLAG_BANKED) { *output = it.current; return true; @@ -2774,8 +2774,8 @@ static int32_t ride_check_station_length(CoordsXYE* input, CoordsXYE* output) do { - const auto& teDescriptor = GetTrackElementDescriptor(output->element->AsTrack()->GetTrackType()); - if (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) + const auto& ted = GetTrackElementDescriptor(output->element->AsTrack()->GetTrackType()); + if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) { num_station_elements++; last_good_station = *output; @@ -2822,8 +2822,8 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input) // Check back of the track track_get_back(input, &trackBack); auto trackType = trackBack.element->AsTrack()->GetTrackType(); - auto teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + auto ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) { return false; } @@ -2832,8 +2832,8 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input) // Check front of the track track_get_front(input, &trackFront); trackType = trackFront.element->AsTrack()->GetTrackType(); - teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) { return false; } @@ -2869,8 +2869,8 @@ static void ride_set_boat_hire_return_point(Ride* ride, CoordsXYE* startElement) }; trackType = returnPos.element->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - int32_t elementReturnDirection = teDescriptor.Coordinates.rotation_begin; + const auto& ted = GetTrackElementDescriptor(trackType); + int32_t elementReturnDirection = ted.Coordinates.rotation_begin; ride->boat_hire_return_direction = returnPos.element->GetDirectionWithOffset(elementReturnDirection); ride->boat_hire_return_position = TileCoordsXY{ returnPos }; } @@ -3544,8 +3544,8 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying) if (tileElement->GetBaseZ() != location.z) continue; - const auto& teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) { continue; } @@ -3777,8 +3777,8 @@ TrackElement* Ride::GetOriginElement(StationIndex stationIndex) const continue; auto* trackElement = tileElement->AsTrack(); - const auto& teDescriptor = GetTrackElementDescriptor(trackElement->GetTrackType()); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType()); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue; if (trackElement->GetRideIndex() == id) @@ -4884,8 +4884,8 @@ static int32_t ride_get_track_length(Ride* ride) continue; trackType = tileElement->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue; if (tileElement->GetBaseZ() != trackStart.z) @@ -4916,8 +4916,8 @@ static int32_t ride_get_track_length(Ride* ride) while (track_circuit_iterator_next(&it)) { trackType = it.current.element->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - result += teDescriptor.PieceLength; + const auto& ted = GetTrackElementDescriptor(trackType); + result += ted.PieceLength; moveSlowIt = !moveSlowIt; if (moveSlowIt) diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 980b0412c4..620761a8b4 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -394,8 +394,8 @@ std::optional sub_6C683D( } // Possibly z should be & 0xF8 - const auto& teDescriptor = GetTrackElementDescriptor(type); - const auto* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(type); + const auto* trackBlock = ted.Block; if (trackBlock == nullptr) return std::nullopt; @@ -630,7 +630,7 @@ void ride_construction_set_default_next_piece() TileElement* tileElement; _currentTrackPrice = MONEY32_UNDEFINED; - TrackElementDescriptor teDescriptor; + TrackElementDescriptor ted; switch (_rideConstructionState) { case RideConstructionState::Front: @@ -659,8 +659,8 @@ void ride_construction_set_default_next_piece() } } - teDescriptor = GetTrackElementDescriptor(trackType); - curve = teDescriptor.CurveChain.next; + ted = GetTrackElementDescriptor(trackType); + curve = ted.CurveChain.next; bank = TrackDefinitions[trackType].bank_end; slope = TrackDefinitions[trackType].vangle_end; @@ -705,8 +705,8 @@ void ride_construction_set_default_next_piece() } } - teDescriptor = GetTrackElementDescriptor(trackType); - curve = teDescriptor.CurveChain.previous; + ted = GetTrackElementDescriptor(trackType); + curve = ted.CurveChain.previous; bank = TrackDefinitions[trackType].bank_start; slope = TrackDefinitions[trackType].vangle_start; @@ -1254,8 +1254,8 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC { if (info.Element->AsTrack()->GetRideIndex() == gRideEntranceExitPlaceRideIndex) { - const auto& teDescriptor = GetTrackElementDescriptor(info.Element->AsTrack()->GetTrackType()); - if (teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) + const auto& ted = GetTrackElementDescriptor(info.Element->AsTrack()->GetTrackType()); + if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) { if (info.Element->AsTrack()->GetTrackType() == TrackElemType::Maze) { @@ -1345,8 +1345,8 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC int32_t eax = (entranceExitCoords.direction + 2 - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK; - const auto& teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - if (teDescriptor.TrackSequenceProperties[tileElement->AsTrack()->GetSequenceIndex()] & (1 << eax)) + const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + if (ted.TrackSequenceProperties[tileElement->AsTrack()->GetSequenceIndex()] & (1 << eax)) { entranceExitCoords.direction = direction_reverse(entranceExitCoords.direction); gRideEntranceExitPlaceDirection = entranceExitCoords.direction; @@ -1439,7 +1439,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC */ void sub_6CB945(Ride* ride) { - TrackElementDescriptor teDescriptor; + TrackElementDescriptor ted; if (ride->type != RIDE_TYPE_MAZE) { for (StationIndex stationId = 0; stationId < MAX_STATIONS; ++stationId) @@ -1475,8 +1475,8 @@ void sub_6CB945(Ride* ride) if (tileElement->AsTrack()->GetSequenceIndex() != 0) continue; - teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue; trackFound = true; @@ -1503,8 +1503,8 @@ void sub_6CB945(Ride* ride) continue; } - teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - const rct_preview_track* trackBlock = teDescriptor.Block; + ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + const rct_preview_track* trackBlock = ted.Block; while ((++trackBlock)->index != 0xFF) { CoordsXYZ blockLocation = location + CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(direction), 0 }; @@ -1520,8 +1520,8 @@ void sub_6CB945(Ride* ride) if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK) continue; - teDescriptor = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType()); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) continue; trackFound = true; @@ -1616,8 +1616,8 @@ void sub_6CB945(Ride* ride) Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3; - teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[trackSequence] & (1 << direction))) + ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[trackSequence] & (1 << direction))) { continue; } diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index a8d51989ed..e2144e571e 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -183,9 +183,9 @@ rct_string_id TrackDesign::CreateTrackDesignTrack(const Ride& ride) trackElement.y = newCoords->y; z = newCoords->z; - const auto& teDescriptor = GetTrackElementDescriptor(trackElement.element->AsTrack()->GetTrackType()); - const rct_track_coordinates* trackCoordinates = &teDescriptor.Coordinates; - const auto* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackElement.element->AsTrack()->GetTrackType()); + const rct_track_coordinates* trackCoordinates = &ted.Coordinates; + const auto* trackBlock = ted.Block; // Used in the following loop to know when we have // completed all of the elements and are back at the // start. @@ -770,8 +770,8 @@ static void track_design_mirror_ride(TrackDesign* td6) { for (auto& track : td6->track_elements) { - const auto& teDescriptor = GetTrackElementDescriptor(track.type); - track.type = teDescriptor.MirrorMap; + const auto& ted = GetTrackElementDescriptor(track.type); + track.type = ted.MirrorMap; } for (auto& entrance : td6->entrance_elements) @@ -1522,14 +1522,14 @@ static std::optional track_design_place_ride(TrackDesign* td6, const Co for (const auto& track : td6->track_elements) { auto trackType = track.type; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); + const auto& ted = GetTrackElementDescriptor(trackType); track_design_update_max_min_coordinates(newCoords); switch (_trackDesignPlaceOperation) { case PTD_OPERATION_DRAW_OUTLINES: - for (const rct_preview_track* trackBlock = teDescriptor.Block; trackBlock->index != 0xFF; trackBlock++) + for (const rct_preview_track* trackBlock = ted.Block; trackBlock->index != 0xFF; trackBlock++) { auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(rotation); track_design_update_max_min_coordinates({ tile, newCoords.z }); @@ -1538,8 +1538,8 @@ static std::optional track_design_place_ride(TrackDesign* td6, const Co break; case PTD_OPERATION_REMOVE_GHOST: { - const rct_track_coordinates* trackCoordinates = &teDescriptor.Coordinates; - const rct_preview_track* trackBlock = teDescriptor.Block; + const rct_track_coordinates* trackCoordinates = &ted.Coordinates; + const rct_preview_track* trackBlock = ted.Block; int32_t tempZ = newCoords.z - trackCoordinates->z_begin + trackBlock->z; auto trackRemoveAction = TrackRemoveAction( trackType, 0, { newCoords, tempZ, static_cast(rotation & 3) }); @@ -1553,7 +1553,7 @@ static std::optional track_design_place_ride(TrackDesign* td6, const Co case PTD_OPERATION_PLACE_GHOST: case PTD_OPERATION_PLACE_TRACK_PREVIEW: { - const rct_track_coordinates* trackCoordinates = &teDescriptor.Coordinates; + const rct_track_coordinates* trackCoordinates = &ted.Coordinates; // di int16_t tempZ = newCoords.z - trackCoordinates->z_begin; @@ -1610,8 +1610,8 @@ static std::optional track_design_place_ride(TrackDesign* td6, const Co } case PTD_OPERATION_GET_PLACE_Z: { - int32_t tempZ = newCoords.z - teDescriptor.Coordinates.z_begin; - for (const rct_preview_track* trackBlock = teDescriptor.Block; trackBlock->index != 0xFF; trackBlock++) + int32_t tempZ = newCoords.z - ted.Coordinates.z_begin; + for (const rct_preview_track* trackBlock = ted.Block; trackBlock->index != 0xFF; trackBlock++) { auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(rotation); if (!map_is_location_valid(tile)) @@ -1650,7 +1650,7 @@ static std::optional track_design_place_ride(TrackDesign* td6, const Co } } - const rct_track_coordinates& track_coordinates = teDescriptor.Coordinates; + const rct_track_coordinates& track_coordinates = ted.Coordinates; auto offsetAndRotatedTrack = CoordsXY{ newCoords } + CoordsXY{ track_coordinates.x, track_coordinates.y }.Rotate(rotation); diff --git a/src/openrct2/ride/TrackPaint.cpp b/src/openrct2/ride/TrackPaint.cpp index 875506f6ed..cfe01185e1 100644 --- a/src/openrct2/ride/TrackPaint.cpp +++ b/src/openrct2/ride/TrackPaint.cpp @@ -2204,8 +2204,8 @@ void PaintTrack(paint_session* session, Direction direction, int32_t height, con if (PaintShouldShowHeightMarkers(session, VIEWPORT_FLAG_TRACK_HEIGHTS)) { session->InteractionType = ViewportInteractionItem::None; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.HeightMarkerPositions & (1 << trackSequence)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.HeightMarkerPositions & (1 << trackSequence)) { uint16_t ax = ride->GetRideTypeDescriptor().Heights.VehicleZOffset; // 0x1689 represents 0 height there are -127 to 128 heights above and below it diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index e4258fe342..4c9057d2d3 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -1707,8 +1707,8 @@ void Vehicle::UpdateMeasurements() } } - const auto& teDescriptor = GetTrackElementDescriptor(trackElemType); - uint16_t trackFlags = teDescriptor.Flags; + const auto& ted = GetTrackElementDescriptor(trackElemType); + uint16_t trackFlags = ted.Flags; uint32_t testingFlags = curRide->testing_flags; if (testingFlags & RIDE_TESTING_TURN_LEFT && trackFlags & TRACK_ELEM_FLAG_TURN_LEFT) @@ -7495,13 +7495,13 @@ static void AnimateSceneryDoor(const CoordsXYZD& doorLocation, const CoordsXYZ& void Vehicle::UpdateSceneryDoor() const { auto trackType = GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_preview_track* trackBlock = ted.Block; while ((trackBlock + 1)->index != 255) { trackBlock++; } - const rct_track_coordinates* trackCoordinates = &teDescriptor.Coordinates; + const rct_track_coordinates* trackCoordinates = &ted.Coordinates; auto wallCoords = CoordsXYZ{ x, y, TrackLocation.z - trackBlock->z + trackCoordinates->z_end }.ToTileStart(); int32_t direction = (GetTrackDirection() + trackCoordinates->rotation_end) & 3; @@ -7593,9 +7593,9 @@ static void trigger_on_ride_photo(const CoordsXYZ& loc, TileElement* tileElement void Vehicle::UpdateSceneryDoorBackwards() const { auto trackType = GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_preview_track* trackBlock = teDescriptor.Block; - const rct_track_coordinates* trackCoordinates = &teDescriptor.Coordinates; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_preview_track* trackBlock = ted.Block; + const rct_track_coordinates* trackCoordinates = &ted.Coordinates; auto wallCoords = CoordsXYZ{ TrackLocation, TrackLocation.z - trackBlock->z + trackCoordinates->z_begin }; int32_t direction = (GetTrackDirection() + trackCoordinates->rotation_begin) & 3; direction = direction_reverse(direction); @@ -7933,8 +7933,8 @@ void Vehicle::Sub6DBF3E() } auto trackType = GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) { return; } @@ -8547,8 +8547,8 @@ bool Vehicle::UpdateTrackMotionBackwardsGetNewTrack(uint16_t trackType, Ride* cu if (next_vehicle_on_train == SPRITE_INDEX_NULL) { trackType = tileElement->AsTrack()->GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.Flags & TRACK_ELEM_FLAG_DOWN)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.Flags & TRACK_ELEM_FLAG_DOWN)) { _vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_9; } @@ -9209,8 +9209,8 @@ loc_6DCE02: } { auto trackType = GetTrackType(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)) { return; } diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index dd0313d2fb..2fb047ac62 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -91,8 +91,8 @@ money32 place_provisional_track_piece( return result; int16_t z_begin, z_end; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_track_coordinates& coords = teDescriptor.Coordinates; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_track_coordinates& coords = ted.Coordinates; if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK)) { z_begin = coords.z_begin; @@ -306,8 +306,8 @@ bool window_ride_construction_update_state( && _currentTrackAlternative & RIDE_TYPE_ALTERNATIVE_TRACK_PIECES) { auto availablePieces = rtd.CoveredTrackPieces; - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - auto alternativeType = teDescriptor.AlternativeType; + const auto& ted = GetTrackElementDescriptor(trackType); + auto alternativeType = ted.AlternativeType; if (alternativeType != TrackElemType::None && (availablePieces & (1ULL << trackType))) { trackType = alternativeType; @@ -315,8 +315,8 @@ bool window_ride_construction_update_state( } } - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - const rct_track_coordinates& trackCoordinates = teDescriptor.Coordinates; + const auto& ted = GetTrackElementDescriptor(trackType); + const rct_track_coordinates& trackCoordinates = ted.Coordinates; x = _currentTrackBegin.x; y = _currentTrackBegin.y; @@ -349,13 +349,13 @@ bool window_ride_construction_update_state( bool turnOffLiftHill = false; if (!(_enabledRidePieces & (1ULL << TRACK_LIFT_HILL_CURVE))) { - if (teDescriptor.Flags & TRACK_ELEM_FLAG_CURVE_ALLOWS_LIFT) + if (ted.Flags & TRACK_ELEM_FLAG_CURVE_ALLOWS_LIFT) { turnOffLiftHill = true; } } - if (!(teDescriptor.Flags & TRACK_ELEM_FLAG_ALLOW_LIFT_HILL)) + if (!(ted.Flags & TRACK_ELEM_FLAG_ALLOW_LIFT_HILL)) { turnOffLiftHill = true; } diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 33c520a3e6..92bf23ead8 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -881,15 +881,15 @@ static void loc_6A6D7E( const auto trackType = tileElement->AsTrack()->GetTrackType(); const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) { return; } uint16_t dx = direction_reverse( (direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK); - if (!(teDescriptor.TrackSequenceProperties[trackSequence] & (1 << dx))) + if (!(ted.TrackSequenceProperties[trackSequence] & (1 << dx))) { return; } @@ -965,13 +965,13 @@ static void loc_6A6C85( const auto trackType = tileElementPos.element->AsTrack()->GetTrackType(); const uint8_t trackSequence = tileElementPos.element->AsTrack()->GetSequenceIndex(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (!(teDescriptor.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) + const auto& ted = GetTrackElementDescriptor(trackType); + if (!(ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)) { return; } uint16_t dx = (direction - tileElementPos.element->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK; - if (!(teDescriptor.TrackSequenceProperties[trackSequence] & (1 << dx))) + if (!(ted.TrackSequenceProperties[trackSequence] & (1 << dx))) { return; } @@ -2107,11 +2107,11 @@ bool tile_element_wants_path_connection_towards(const TileCoordsXYZD& coords, co const auto trackType = tileElement->AsTrack()->GetTrackType(); const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex(); - const auto& teDescriptor = GetTrackElementDescriptor(trackType); - if (teDescriptor.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH) + const auto& ted = GetTrackElementDescriptor(trackType); + if (ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH) { uint16_t dx = ((coords.direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK); - if (teDescriptor.TrackSequenceProperties[trackSequence] & (1 << dx)) + if (ted.TrackSequenceProperties[trackSequence] & (1 << dx)) { // Track element has the flags required for the given direction return true; diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index cf1a998b22..3520dcfcd4 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -855,8 +855,8 @@ namespace OpenRCT2::TileInspector if (ride == nullptr) return std::make_unique(GameActions::Status::Unknown, STR_NONE); - const auto& teDescriptor = GetTrackElementDescriptor(type); - const auto* trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(type); + const auto* trackBlock = ted.Block; trackBlock += trackElement->AsTrack()->GetSequenceIndex(); uint8_t originDirection = trackElement->GetDirection(); @@ -868,7 +868,7 @@ namespace OpenRCT2::TileInspector originY = static_cast(coords.y); originZ -= trackBlock->z; - trackBlock = teDescriptor.Block; + trackBlock = ted.Block; for (; trackBlock->index != 255; trackBlock++) { CoordsXYZD elem = { originX, originY, originZ + trackBlock->z, rotation }; @@ -939,8 +939,8 @@ namespace OpenRCT2::TileInspector if (ride == nullptr) return std::make_unique(GameActions::Status::Unknown, STR_NONE); - const auto& teDescriptor = GetTrackElementDescriptor(type); - auto trackBlock = teDescriptor.Block; + const auto& ted = GetTrackElementDescriptor(type); + auto trackBlock = ted.Block; trackBlock += trackElement->AsTrack()->GetSequenceIndex(); uint8_t originDirection = trackElement->GetDirection(); @@ -952,7 +952,7 @@ namespace OpenRCT2::TileInspector originY = static_cast(coords.y); originZ -= trackBlock->z; - trackBlock = teDescriptor.Block; + trackBlock = ted.Block; for (; trackBlock->index != 255; trackBlock++) { CoordsXYZD elem = { originX, originY, originZ + trackBlock->z, rotation };