From 3a9900cd148d094f287f79cf5349aaee5dfe9e0f Mon Sep 17 00:00:00 2001 From: Rik Smeets <30838294+rik-smeets@users.noreply.github.com> Date: Sat, 5 Nov 2022 17:32:22 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20#1519:=20=E2=80=9CSee-through=20rides?= =?UTF-8?q?=E2=80=9D=20doesn=E2=80=99t=20affect=20all=20rides?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rides without track can technically have a vehicle, such as the merry go round or the pirate ship. These vehicles should be hidden of 'see through rides' is enabled. --- distribution/changelog.txt | 1 + src/openrct2/interface/Viewport.cpp | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 9f59065a98..62f6f7b72e 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -11,6 +11,7 @@ - Change: [#17998] Show cursor when using inverted mouse dragging. - Change: [#18230] Make the large flat to steep pieces available on the corkscrew roller coaster without cheats. - Change: [#18381] Convert custom invisible paths to the built-in ones. +- Fix: [#1519] “See-through rides” doesn't affect all rides (original bug). - Fix: [#11679] Facilities clipping issues. - Fix: [#14312] Research ride type message incorrect. - Fix: [#14425] Ride ratings do not skip unallocated ride ids. diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index d3fe9bcfc7..4c0b5efbcd 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -25,6 +25,7 @@ #include "../paint/Paint.h" #include "../profiling/Profiling.h" #include "../ride/Ride.h" +#include "../ride/RideData.h" #include "../ride/TrackDesign.h" #include "../ride/Vehicle.h" #include "../ui/UiContext.h" @@ -1414,12 +1415,29 @@ VisibilityKind GetPaintStructVisibility(const PaintStruct* ps, uint32_t viewFlag switch (ps->entity->Type) { case EntityType::Vehicle: + { if (viewFlags & VIEWPORT_FLAG_HIDE_VEHICLES) { return (viewFlags & VIEWPORT_FLAG_INVISIBLE_VEHICLES) ? VisibilityKind::Hidden : VisibilityKind::Partial; } + // Rides without track can technically have a 'vehicle': + // these should be hidden if 'hide rides' is enabled + if (viewFlags & VIEWPORT_FLAG_HIDE_RIDES) + { + auto vehicle = ps->entity->As(); + if (vehicle == nullptr) + break; + + auto ride = vehicle->GetRide(); + if (ride != nullptr && ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_HAS_NO_TRACK)) + { + return (viewFlags & VIEWPORT_FLAG_INVISIBLE_RIDES) ? VisibilityKind::Hidden + : VisibilityKind::Partial; + } + } break; + } case EntityType::Guest: if (viewFlags & VIEWPORT_FLAG_HIDE_GUESTS) {