From 925d21eeda14d10edf0920aceed85f8fea20a43b Mon Sep 17 00:00:00 2001 From: Helio Santos Date: Fri, 10 Jul 2020 09:59:06 -0700 Subject: [PATCH] Part of #12159: update check_for_adjacent_station to use CoordsXYZ& Update check_for_adjacent_station to use CoordsXYZ&. Updated caller(s) accordingly. --- src/openrct2/ride/Ride.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b4337d4de8..f8ff735cb0 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -7247,16 +7247,17 @@ TileElement* get_station_platform(const CoordsXYRangedZ& coords) /** * Check for an adjacent station to x,y,z in direction. */ -static bool check_for_adjacent_station(int32_t x, int32_t y, int32_t z, uint8_t direction) +static bool check_for_adjacent_station(const CoordsXYZ& stationCoords, uint8_t direction) { bool found = false; - int32_t adjX = x; - int32_t adjY = y; + int32_t adjX = stationCoords.x; + int32_t adjY = stationCoords.y; for (uint32_t i = 0; i <= RIDE_ADJACENCY_CHECK_DISTANCE; i++) { adjX += CoordsDirectionDelta[direction].x; adjY += CoordsDirectionDelta[direction].y; - TileElement* stationElement = get_station_platform({ { adjX, adjY, z }, z + 2 * COORDS_Z_STEP }); + TileElement* stationElement = get_station_platform( + { { adjX, adjY, stationCoords.z }, stationCoords.z + 2 * COORDS_Z_STEP }); if (stationElement != nullptr) { auto rideIndex = stationElement->AsTrack()->GetRideIndex(); @@ -7292,12 +7293,12 @@ bool ride_has_adjacent_station(Ride* ride) } /* Check the first side of the station */ int32_t direction = stationElement->GetDirectionWithOffset(1); - found = check_for_adjacent_station(stationStart.x, stationStart.y, stationStart.z, direction); + found = check_for_adjacent_station(stationStart, direction); if (found) break; /* Check the other side of the station */ direction = direction_reverse(direction); - found = check_for_adjacent_station(stationStart.x, stationStart.y, stationStart.z, direction); + found = check_for_adjacent_station(stationStart, direction); if (found) break; }