mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Part of #12159: update check_for_adjacent_station to use CoordsXYZ&
Update check_for_adjacent_station to use CoordsXYZ&. Updated caller(s) accordingly.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user