From 9e236d1b5a231d7bcaaa15ee69c0adce1a33e780 Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sat, 20 Apr 2024 18:45:48 +0200 Subject: [PATCH] Fix #19559: Vehicle descriptions spill over into preview --- distribution/changelog.txt | 1 + src/openrct2-ui/windows/Ride.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 51a29c1c9a..edfcaccf5f 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -6,6 +6,7 @@ - Change: [#21715] [Plugin] Remove access to the internal `owner` property. Note: `ownership` is still accessible. - Change: [#21855] Cheats menu dropdown no longer requires dragging. - Fix: [#866] Boat Hire boats get stuck entering track. +- Fix: [#19559] Custom rides with long descriptions extend into lower widgets. - Fix: [#21696] Fullscreen window option not correctly applied on macOS. - Fix: [#21787] Map generator heightmap should respect increased height limits. - Fix: [#21829] When creating a new scenario, the default name contains formatting codes. diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index f208f8b7b8..58ded38844 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -2559,7 +2559,8 @@ static_assert(std::size(RatingNames) == 6); void VehicleResize() { - WindowSetResize(*this, 316, 221, 316, 221); + auto bottom = widgets[WIDX_VEHICLE_TRAINS].bottom + 6; + WindowSetResize(*this, 316, bottom, 316, bottom); } void VehicleOnMouseDown(WidgetIndex widgetIndex) @@ -2842,6 +2843,19 @@ static_assert(std::size(RatingNames) == 6); StringId stringId = rideEntry->nausea_multiplier > 0 ? STR_NAUSEA_FACTOR : STR_NAUSEA_FACTOR_NEGATIVE; DrawTextBasic(dpi, screenCoords, stringId, ft); } + + const auto minimumPreviewStart = screenCoords.y - windowPos.y + kListRowHeight + 5; + if (minimumPreviewStart > widgets[WIDX_VEHICLE_TRAINS_PREVIEW].top) + { + auto heightIncrease = minimumPreviewStart - widgets[WIDX_VEHICLE_TRAINS_PREVIEW].top; + height += heightIncrease; + ResizeFrameWithPage(); + + for (auto i = EnumValue(WIDX_VEHICLE_TRAINS_PREVIEW); i <= WIDX_VEHICLE_CARS_PER_TRAIN_DECREASE; i++) + { + widgets[i].moveDown(heightIncrease); + } + } } struct VehicleDrawInfo