Codechange: Use std::initializer_list for NWidgetPart data. (#14749)

Avoids using C/C++ arrays.
This commit is contained in:
Peter Nelson
2025-11-01 22:33:00 +00:00
committed by dP
parent 49dd74ea89
commit c2d92433c6
62 changed files with 160 additions and 158 deletions

View File

@@ -205,7 +205,7 @@ static constexpr TextColour GAME_OPTIONS_LABEL = TC_LIGHT_BLUE;
/** Colour for selected text of game options. */
static constexpr TextColour GAME_OPTIONS_SELECTED = TC_WHITE;
static constexpr NWidgetPart _nested_social_plugins_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_social_plugins_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_FRAME, GAME_OPTIONS_BACKGROUND, WID_GO_SOCIAL_PLUGIN_TITLE), SetTextStyle(GAME_OPTIONS_FRAME),
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0),
@@ -220,7 +220,7 @@ static constexpr NWidgetPart _nested_social_plugins_widgets[] = {
EndContainer(),
};
static constexpr NWidgetPart _nested_social_plugins_none_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_social_plugins_none_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXT, INVALID_COLOUR), SetResize(1, 0), SetFill(1, 0), SetStringTip(STR_GAME_OPTIONS_SOCIAL_PLUGINS_NONE), SetTextStyle(GAME_OPTIONS_LABEL),
EndContainer(),
@@ -1607,7 +1607,7 @@ struct GameOptionsWindow : Window {
}
};
static constexpr NWidgetPart _nested_game_options_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_game_options_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, GAME_OPTIONS_BACKGROUND),
NWidget(WWT_CAPTION, GAME_OPTIONS_BACKGROUND), SetStringTip(STR_GAME_OPTIONS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -2147,7 +2147,7 @@ struct CustomCurrencyWindow : Window {
}
};
static constexpr NWidgetPart _nested_cust_currency_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_cust_currency_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY), SetStringTip(STR_CURRENCY_WINDOW, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),