1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-28 06:34:33 +01:00

Codechange: Pass by reference to UpdateWidgetSize. (#12457)

These parameters are always provided and not optional.
This commit is contained in:
Peter Nelson
2024-04-09 08:34:45 +01:00
committed by GitHub
parent b5ad28022d
commit de4e00c93f
55 changed files with 602 additions and 602 deletions

View File

@@ -263,23 +263,23 @@ struct SignListWindow : Window, SignList {
this->vscroll->SetCapacityFromWidget(this, WID_SIL_LIST, WidgetDimensions::scaled.framerect.Vertical());
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_SIL_LIST: {
Dimension spr_dim = GetSpriteSize(SPR_COMPANY_ICON);
this->text_offset = WidgetDimensions::scaled.frametext.left + spr_dim.width + 2; // 2 pixels space between icon and the sign text.
resize->height = std::max<uint>(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2);
Dimension d = {(uint)(this->text_offset + WidgetDimensions::scaled.frametext.right), padding.height + 5 * resize->height};
*size = maxdim(*size, d);
resize.height = std::max<uint>(GetCharacterHeight(FS_NORMAL), spr_dim.height + 2);
Dimension d = {(uint)(this->text_offset + WidgetDimensions::scaled.frametext.right), padding.height + 5 * resize.height};
size = maxdim(size, d);
break;
}
case WID_SIL_CAPTION:
SetDParamMaxValue(0, Sign::GetPoolSize(), 3);
*size = GetStringBoundingBox(STR_SIGN_LIST_CAPTION);
size->height += padding.height;
size->width += padding.width;
size = GetStringBoundingBox(STR_SIGN_LIST_CAPTION);
size.height += padding.height;
size.width += padding.width;
break;
}
}