Skip to content

Commit

Permalink
Avoid triggering an assert when saving the park
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt committed Feb 24, 2023
1 parent be52b55 commit 777fea6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/openrct2/park/ParkFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,12 @@ namespace OpenRCT2
// Ride ID
cs.ReadWrite(rideId);

auto& ride = *RideAllocateAtIndex(rideId);
auto& ride = [&]() -> Ride& {
if (cs.GetMode() == OrcaStream::Mode::WRITING)
return *GetRide(rideId);
else
return *RideAllocateAtIndex(rideId);
}();

// Status
cs.ReadWrite(ride.type);
Expand Down

0 comments on commit 777fea6

Please sign in to comment.