diff --git a/src/lang/english.txt b/src/lang/english.txt index b8cae5ff4e..577c23a8d1 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2857,10 +2857,8 @@ STR_HOUSE_PICKER_CLASS_ZONE3 :Outer Suburbs STR_HOUSE_PICKER_CLASS_ZONE4 :Inner Suburbs STR_HOUSE_PICKER_CLASS_ZONE5 :Town centre -STR_HOUSE_PICKER_PROTECT_TITLE :Prevent upgrades +STR_HOUSE_PICKER_PROTECT :Prevent upgrades STR_HOUSE_PICKER_PROTECT_TOOLTIP :Choose whether this house will be protected from replacement as the town grows -STR_HOUSE_PICKER_PROTECT_OFF :Off -STR_HOUSE_PICKER_PROTECT_ON :On STR_HOUSE_PICKER_OVERBUILD :Overbuild existing STR_HOUSE_PICKER_OVERBUILD_TOOLTIP :Choose whether to automatically remove an existing house on the tile where this house is placed diff --git a/src/town_gui.cpp b/src/town_gui.cpp index b1df3c68d8..e9d496b23d 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1734,11 +1734,9 @@ struct BuildHouseWindow : public PickerWindow { void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override { switch (widget) { - case WID_BH_PROTECT_OFF: - case WID_BH_PROTECT_ON: - BuildHouseWindow::house_protected = (widget == WID_BH_PROTECT_ON); - this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected); - this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected); + case WID_BH_PROTECT_TOGGLE: + BuildHouseWindow::house_protected = !BuildHouseWindow::house_protected; + this->SetWidgetLoweredState(WID_BH_PROTECT_TOGGLE, BuildHouseWindow::house_protected); if (_settings_client.sound.click_beep) SndPlayFx(SND_15_BEEP); this->SetDirty(); @@ -1775,13 +1773,10 @@ struct BuildHouseWindow : public PickerWindow { bool hasflag = spec->extra_flags.Test(HouseExtraFlag::BuildingIsProtected); if (hasflag) BuildHouseWindow::house_protected = true; - this->SetWidgetLoweredState(WID_BH_PROTECT_OFF, !BuildHouseWindow::house_protected); - this->SetWidgetLoweredState(WID_BH_PROTECT_ON, BuildHouseWindow::house_protected); + this->SetWidgetLoweredState(WID_BH_PROTECT_TOGGLE, BuildHouseWindow::house_protected); this->SetWidgetLoweredState(WID_BH_OVERBUILD_TOGGLE, BuildHouseWindow::overbuild); - - this->SetWidgetDisabledState(WID_BH_PROTECT_OFF, hasflag); - this->SetWidgetDisabledState(WID_BH_PROTECT_ON, hasflag); + this->SetWidgetDisabledState(WID_BH_PROTECT_TOGGLE, hasflag); } void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override @@ -1817,11 +1812,7 @@ static constexpr NWidgetPart _nested_build_house_widgets[] = { NWidget(WWT_PANEL, COLOUR_DARK_GREEN), NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_picker, 0), SetPadding(WidgetDimensions::unscaled.picker), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BH_INFO), SetFill(1, 1), SetMinimalTextLines(10, 0), - NWidget(WWT_LABEL, INVALID_COLOUR), SetStringTip(STR_HOUSE_PICKER_PROTECT_TITLE, STR_NULL), SetFill(1, 0), - NWidget(NWID_HORIZONTAL), SetPIPRatio(1, 0, 1), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_PROTECT_OFF), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_PROTECT_OFF, STR_HOUSE_PICKER_PROTECT_TOOLTIP), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_PROTECT_ON), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_PROTECT_ON, STR_HOUSE_PICKER_PROTECT_TOOLTIP), - EndContainer(), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_PROTECT_TOGGLE), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_PROTECT, STR_HOUSE_PICKER_PROTECT_TOOLTIP), NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_OVERBUILD_TOGGLE), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_OVERBUILD, STR_HOUSE_PICKER_OVERBUILD_TOOLTIP), EndContainer(), EndContainer(), diff --git a/src/widgets/town_widget.h b/src/widgets/town_widget.h index b51aa76fa1..9841cbd54c 100644 --- a/src/widgets/town_widget.h +++ b/src/widgets/town_widget.h @@ -77,8 +77,7 @@ enum TownFoundingWidgets : WidgetID { /** Widgets of the #BuildHouseWindow class. */ enum BuildHouseWidgets : WidgetID { WID_BH_INFO, ///< Information panel of selected house. - WID_BH_PROTECT_OFF, ///< Button to protect the next house built. - WID_BH_PROTECT_ON, ///< Button to not protect the next house built. + WID_BH_PROTECT_TOGGLE, ///< Button to toggle protecting the next house built. WID_BH_OVERBUILD_TOGGLE, ///< Button to toggle overbuilding existing houses. };