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

These parameters are always provided and not optional.
This commit is contained in:
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

@@ -648,7 +648,7 @@ struct GameOptionsWindow : Window {
if (changed) this->ReInit(0, 0, this->flags & WF_CENTERED);
}
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_GO_TEXT_SFX_VOLUME:
@@ -656,7 +656,7 @@ struct GameOptionsWindow : Window {
Dimension d = maxdim(GetStringBoundingBox(STR_GAME_OPTIONS_SFX_VOLUME), GetStringBoundingBox(STR_GAME_OPTIONS_MUSIC_VOLUME));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@@ -669,7 +669,7 @@ struct GameOptionsWindow : Window {
case WID_GO_BASE_SFX_DROPDOWN:
case WID_GO_BASE_MUSIC_DROPDOWN: {
int selected;
size->width = std::max(size->width, GetDropDownListDimension(this->BuildDropDownList(widget, &selected)).width + padding.width);
size.width = std::max(size.width, GetDropDownListDimension(this->BuildDropDownList(widget, &selected)).width + padding.width);
break;
}
}
@@ -2364,14 +2364,14 @@ struct GameSettingsWindow : Window {
_circle_size = maxdim(GetSpriteSize(SPR_CIRCLE_FOLDED), GetSpriteSize(SPR_CIRCLE_UNFOLDED));
}
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_GS_OPTIONSPANEL:
resize->height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal;
resize->width = 1;
resize.height = SETTING_HEIGHT = std::max({(int)_circle_size.height, SETTING_BUTTON_HEIGHT, GetCharacterHeight(FS_NORMAL)}) + WidgetDimensions::scaled.vsep_normal;
resize.width = 1;
size->height = 5 * resize->height + WidgetDimensions::scaled.framerect.Vertical();
size.height = 5 * resize.height + WidgetDimensions::scaled.framerect.Vertical();
break;
case WID_GS_HELP_TEXT: {
@@ -2382,16 +2382,16 @@ struct GameSettingsWindow : Window {
};
for (uint i = 0; i < lengthof(setting_types); i++) {
SetDParam(0, setting_types[i]);
size->width = std::max(size->width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width + padding.width);
size.width = std::max(size.width, GetStringBoundingBox(STR_CONFIG_SETTING_TYPE).width + padding.width);
}
size->height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal +
std::max(size->height, GetSettingsTree().GetMaxHelpHeight(size->width));
size.height = 2 * GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal +
std::max(size.height, GetSettingsTree().GetMaxHelpHeight(size.width));
break;
}
case WID_GS_RESTRICT_CATEGORY:
case WID_GS_RESTRICT_TYPE:
size->width = std::max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width);
size.width = std::max(GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_CATEGORY).width, GetStringBoundingBox(STR_CONFIG_SETTING_RESTRICT_TYPE).width);
break;
default:
@@ -3010,7 +3010,7 @@ struct CustomCurrencyWindow : Window {
}
}
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) {
/* Set the appropriate width for the up/down buttons. */
@@ -3018,21 +3018,21 @@ struct CustomCurrencyWindow : Window {
case WID_CC_RATE_UP:
case WID_CC_YEAR_DOWN:
case WID_CC_YEAR_UP:
*size = maxdim(*size, {(uint)SETTING_BUTTON_WIDTH / 2, (uint)SETTING_BUTTON_HEIGHT});
size = maxdim(size, {(uint)SETTING_BUTTON_WIDTH / 2, (uint)SETTING_BUTTON_HEIGHT});
break;
/* Set the appropriate width for the edit buttons. */
case WID_CC_SEPARATOR_EDIT:
case WID_CC_PREFIX_EDIT:
case WID_CC_SUFFIX_EDIT:
*size = maxdim(*size, {(uint)SETTING_BUTTON_WIDTH, (uint)SETTING_BUTTON_HEIGHT});
size = maxdim(size, {(uint)SETTING_BUTTON_WIDTH, (uint)SETTING_BUTTON_HEIGHT});
break;
/* Make sure the window is wide enough for the widest exchange rate */
case WID_CC_RATE:
SetDParam(0, 1);
SetDParam(1, INT32_MAX);
*size = GetStringBoundingBox(STR_CURRENCY_EXCHANGE_RATE);
size = GetStringBoundingBox(STR_CURRENCY_EXCHANGE_RATE);
break;
}
}