From 64e5602d60fa7fab7c90bc85eab6d6a9db2d590f Mon Sep 17 00:00:00 2001 From: mix <167040362+mixiate@users.noreply.github.com> Date: Tue, 10 Jun 2025 19:35:43 +0100 Subject: [PATCH] Fix right click ride construction bugs when ghost track on same tile --- distribution/changelog.txt | 2 ++ src/openrct2/ride/RideConstruction.cpp | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c589ed276a..0c04b53590 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,8 @@ - Feature: [#24411] Vanilla scenarios now also have previews in the scenario selection window. - Change: [objects#383] Disable all base colours on non-remappable WWTT vehicles, change black to light_blue. - Change: [objects#384] Remove erroneously enabled WWTT third remaps. +- Fix: [#15846] Rightclicking on track piece when there is construction below does not work. +- Fix: [#24576] It is possible to edit open rides in certain circumstances. 0.4.23 (2025-06-07) ------------------------------------------------------------------------ diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 56788ea36c..a13175a7b9 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -986,13 +986,8 @@ bool RideModify(const CoordsXYE& input) if (tileElement.element->GetType() == TileElementType::Entrance) return ride_modify_entrance_or_exit(tileElement); - ride_create_or_find_construction_window(rideIndex); - - const auto& rtd = ride->getRideTypeDescriptor(); - if (rtd.specialType == RtdSpecialType::maze) - { - return ride_modify_maze(tileElement); - } + if (tileElement.element->GetType() != TileElementType::Track) + return false; if (ride->getRideTypeDescriptor().HasFlag(RtdFlag::cannotHaveGaps)) { @@ -1001,12 +996,18 @@ bool RideModify(const CoordsXYE& input) tileElement = endOfTrackElement; } - if (tileElement.element == nullptr || tileElement.element->GetType() != TileElementType::Track) - return false; + const auto tileCoords = CoordsXYZ{ tileElement, tileElement.element->GetBaseZ() }; + const auto direction = tileElement.element->GetDirection(); + const auto type = tileElement.element->AsTrack()->GetTrackType(); + + ride_create_or_find_construction_window(rideIndex); + + const auto& rtd = ride->getRideTypeDescriptor(); + if (rtd.specialType == RtdSpecialType::maze) + { + return ride_modify_maze(tileElement); + } - auto tileCoords = CoordsXYZ{ tileElement, tileElement.element->GetBaseZ() }; - auto direction = tileElement.element->GetDirection(); - auto type = tileElement.element->AsTrack()->GetTrackType(); auto newCoords = GetTrackElementOriginAndApplyChanges({ tileCoords, direction }, type, 0, nullptr, {}); if (!newCoords.has_value()) return false;