mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Fix GetOrAllocateRide
This commit is contained in:
@@ -184,15 +184,12 @@ ride_id_t GetNextFreeRideId()
|
||||
|
||||
Ride* GetOrAllocateRide(ride_id_t index)
|
||||
{
|
||||
Ride* result{};
|
||||
if (index < _rides.size())
|
||||
if (_rides.size() <= index)
|
||||
{
|
||||
result = &_rides[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
result = &_rides.emplace_back();
|
||||
_rides.resize(index + 1);
|
||||
}
|
||||
|
||||
auto result = &_rides[index];
|
||||
result->id = index;
|
||||
return result;
|
||||
}
|
||||
@@ -204,6 +201,7 @@ Ride* get_ride(ride_id_t index)
|
||||
auto& ride = _rides[index];
|
||||
if (ride.type != RIDE_TYPE_NULL)
|
||||
{
|
||||
assert(ride.id == index);
|
||||
return &ride;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user