Only shift ride locations if they are not null

This commit is contained in:
Gymnasiast 2024-04-23 19:34:20 +02:00
parent aa7e1e0952
commit d48a60b700
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
1 changed files with 21 additions and 9 deletions

View File

@ -2239,6 +2239,18 @@ MapRange ClampRangeWithinMap(const MapRange& range)
return validRange;
}
static inline void shiftIfNotNull(TileCoordsXY& coords, const TileCoordsXY& amount)
{
if (!coords.IsNull())
coords += amount;
}
static inline void shiftIfNotNull(CoordsXY& coords, const CoordsXY& amount)
{
if (!coords.IsNull())
coords += amount;
}
void ShiftMap(const TileCoordsXY& amount)
{
if (amount.x == 0 && amount.y == 0)
@ -2393,17 +2405,17 @@ void ShiftMap(const TileCoordsXY& amount)
auto& stations = ride.GetStations();
for (auto& station : stations)
{
station.Start += amountToMove;
station.Entrance += amount;
station.Exit += amount;
shiftIfNotNull(station.Start, amountToMove);
shiftIfNotNull(station.Entrance, amount);
shiftIfNotNull(station.Exit, amount);
}
ride.overall_view += amountToMove;
ride.boat_hire_return_position += amount;
ride.CurTestTrackLocation += amount;
ride.ChairliftBullwheelLocation[0] += amount;
ride.ChairliftBullwheelLocation[1] += amount;
ride.CableLiftLoc += amountToMove;
shiftIfNotNull(ride.overall_view, amountToMove);
shiftIfNotNull(ride.boat_hire_return_position, amount);
shiftIfNotNull(ride.CurTestTrackLocation, amount);
shiftIfNotNull(ride.ChairliftBullwheelLocation[0], amount);
shiftIfNotNull(ride.ChairliftBullwheelLocation[1], amount);
shiftIfNotNull(ride.CableLiftLoc, amountToMove);
}
// Banners