Road stops: Shrink build window when changing to a shorter type

This commit is contained in:
Jonathan G Rennison
2023-03-19 10:49:10 +00:00
parent 6f42561859
commit ec73775f97

View File

@@ -1475,9 +1475,11 @@ public:
void UpdateBuildingHeight(uint height) void UpdateBuildingHeight(uint height)
{ {
if (height > this->building_height) { height = std::max<uint>(2, height);
if (height != this->building_height) {
int y_delta = (height - this->building_height) * ScaleGUITrad(8) * 2;
this->building_height = height; this->building_height = height;
this->ReInit(); this->ReInit(0, y_delta);
} }
} }
@@ -1625,6 +1627,9 @@ public:
if (this->vscrollList != nullptr) { if (this->vscrollList != nullptr) {
this->vscrollList->SetCapacityFromWidget(this, WID_BROS_NEWST_LIST); this->vscrollList->SetCapacityFromWidget(this, WID_BROS_NEWST_LIST);
} }
if (this->vscrollMatrix != nullptr) {
this->GetWidget<NWidgetMatrix>(WID_BROS_MATRIX)->SetClicked(_roadstop_gui_settings.roadstop_type);
}
} }
void SetStringParameters(int widget) const override { void SetStringParameters(int widget) const override {