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; }