From ec73775f97c7add6435a73ad9bcddff1bc147ddc Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 19 Mar 2023 10:49:10 +0000 Subject: [PATCH] Road stops: Shrink build window when changing to a shorter type --- src/road_gui.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 90ffd6137c..14de1ff363 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1475,9 +1475,11 @@ public: void UpdateBuildingHeight(uint height) { - if (height > this->building_height) { + height = std::max(2, height); + if (height != this->building_height) { + int y_delta = (height - this->building_height) * ScaleGUITrad(8) * 2; this->building_height = height; - this->ReInit(); + this->ReInit(0, y_delta); } } @@ -1625,6 +1627,9 @@ public: if (this->vscrollList != nullptr) { this->vscrollList->SetCapacityFromWidget(this, WID_BROS_NEWST_LIST); } + if (this->vscrollMatrix != nullptr) { + this->GetWidget(WID_BROS_MATRIX)->SetClicked(_roadstop_gui_settings.roadstop_type); + } } void SetStringParameters(int widget) const override {