From 0ae984842b142df5958a0f6038f63e82b573fe93 Mon Sep 17 00:00:00 2001 From: Basssiiie Date: Wed, 9 Apr 2025 19:29:44 +0200 Subject: [PATCH] Fix track origin being miscalculated for plugins on downward slopes --- distribution/changelog.txt | 1 + src/openrct2/ride/Track.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 53013110d8..5a4b4b9f48 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -5,6 +5,7 @@ - Fix: [#21919] Non-recolourable cars still show colour picker. - Fix: [#23108] Missing pieces on Hypercoaster and Hyper-Twister, even with the ‘all drawable track pieces’ cheat enabled. - Fix: [#24013] Failure to load a scenario preview image (minimap) could lead to an uncaught exception error message. +- Fix: [#24142] [Plugin] Track origin is miscalculated on downward slopes. 0.4.21 (2025-04-05) ------------------------------------------------------------------------ diff --git a/src/openrct2/ride/Track.cpp b/src/openrct2/ride/Track.cpp index 25c9056a9b..2cfafb4ea3 100644 --- a/src/openrct2/ride/Track.cpp +++ b/src/openrct2/ride/Track.cpp @@ -774,7 +774,7 @@ std::optional GetTrackSegmentOrigin(const CoordsXYE& posEl) const auto& trackBlock = ted.sequences[sequenceIndex].clearance; CoordsXY trackBlockOffset = { trackBlock.x, trackBlock.y }; coords += trackBlockOffset.Rotate(DirectionReverse(direction)); - coords.z -= trackBlock.z; + coords.z += ted.sequences[0].clearance.z - trackBlock.z; return CoordsXYZD(coords, direction); }