mirror of https://github.com/OpenRCT2/OpenRCT2.git
Default initialize newly created Rides
This commit is contained in:
parent
d969a4f80d
commit
e3343f263f
|
@ -176,6 +176,12 @@ Ride* RideAllocateAtIndex(RideId index)
|
|||
auto result = &GetGameState().Rides[idx];
|
||||
assert(result->id == RideId::GetNull());
|
||||
|
||||
// Initialize the ride to all the defaults.
|
||||
*result = Ride{};
|
||||
|
||||
// Because it is default initialized to zero rather than the magic constant for Null, fill the array.
|
||||
std::fill(std::begin(result->vehicles), std::end(result->vehicles), EntityId::GetNull());
|
||||
|
||||
result->id = index;
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue