From bcdb769cfd3dc57b8524ac7f476ea64e42596128 Mon Sep 17 00:00:00 2001 From: RayKoopa <9631152+RayKoopa@users.noreply.github.com> Date: Thu, 27 Aug 2026 17:17:24 +0200 Subject: [PATCH] Fix #26802: Splash Boats draw recursion (#26991) Fixes #26802 Skips drawing for 0 or -1 cars per train for `VehiclePaintStyle::splashBoatsOrWaterCoaster` that caused the recursion since they would be invisible anyway even if the recursion would be detected. Tested with 0, -1, and normal amount of cars per train and various numbers of trains. Everything looks fine, and 0 and -1 cars per ride simply draw nothing now. --- distribution/changelog.txt | 1 + src/openrct2/paint/vehicle/Vehicle.SplashBoats.cpp | 8 ++++++++ 2 files changed, 9 insertions(+) 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;