1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-29 15:14:33 +01:00

Codechange: Use SetDisplayedPlane instead of UpdateWidgetSize to hide various buttons (#14831)

This commit is contained in:
mmtunligit
2025-12-01 17:43:48 +01:00
committed by GitHub
parent 66185a312d
commit e96f35cda9
8 changed files with 31 additions and 30 deletions

View File

@@ -697,6 +697,7 @@ public:
SelectCompanyLiveryWindow(WindowDesc &desc, CompanyID company, GroupID group) : Window(desc)
{
this->CreateNestedTree();
this->GetWidget<NWidgetStacked>(WID_SCL_SEC_COL_DROP_SEL)->SetDisplayedPlane(_loaded_newgrf_features.has_2CC ? 0 : SZSP_NONE);
this->vscroll = this->GetScrollbar(WID_SCL_MATRIX_SCROLLBAR);
if (group == GroupID::Invalid()) {
@@ -767,10 +768,7 @@ public:
}
case WID_SCL_SEC_COL_DROPDOWN:
if (!_loaded_newgrf_features.has_2CC) {
size.width = 0;
break;
}
if (!_loaded_newgrf_features.has_2CC) break;
[[fallthrough]];
case WID_SCL_PRI_COL_DROPDOWN: {
@@ -1089,7 +1087,9 @@ static constexpr std::initializer_list<NWidgetPart> _nested_select_company_liver
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PANEL, COLOUR_GREY, WID_SCL_SPACER_DROPDOWN), SetFill(1, 1), SetResize(1, 0), EndContainer(),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_PRI_COL_DROPDOWN), SetFill(0, 1), SetToolTip(STR_LIVERY_PRIMARY_TOOLTIP),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_SEC_COL_DROPDOWN), SetFill(0, 1), SetToolTip(STR_LIVERY_SECONDARY_TOOLTIP),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_SCL_SEC_COL_DROP_SEL),
NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SCL_SEC_COL_DROPDOWN), SetFill(0, 1), SetToolTip(STR_LIVERY_SECONDARY_TOOLTIP),
EndContainer(),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};