diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 1547a2972b..98a3f4dea8 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -18,6 +18,7 @@ - Fix: [#25496] The guest pickup button does not grey out when the guest’s state changes while the window is open. - Fix: [#25558] [Plugin] Image buttons ignore their explicit border setting when a theme draws borders around them. - Fix: [#26056] Freeze when trying to download all objects on save where they are missing. +- Fix: [#26802] Opening rides with 0 or -1 water cars per train crash the game. - Fix: [#26811] Crash when a ride points to a non-existing station object. - Fix: [#26816] Water rides ignore zero clearances, preventing adjacent terrain modifications and building them anywhere. - Fix: [#26880] Max negative G-Force stat on flat track erroneously reads as 0.49g. diff --git a/src/openrct2/paint/vehicle/Vehicle.SplashBoats.cpp b/src/openrct2/paint/vehicle/Vehicle.SplashBoats.cpp index f70e7442dd..485c974315 100644 --- a/src/openrct2/paint/vehicle/Vehicle.SplashBoats.cpp +++ b/src/openrct2/paint/vehicle/Vehicle.SplashBoats.cpp @@ -27,6 +27,14 @@ namespace OpenRCT2 PaintSession& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle, const CarEntry* carEntry) { + // Prevent infinite paint recursion for 0 or -1 cars per train + const auto ride = GetRide(vehicle->ride); + if (ride == nullptr) + return; + const auto rideEntry = ride->getRideEntry(); + if (rideEntry == nullptr || ride->numCarsPerTrain - rideEntry->zero_cars < 1) + return; + // TODO: pass as parameter? auto& entityRegistry = getGameState().entities;