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 c80d21a41a
commit 8ea007df21
62 changed files with 157 additions and 157 deletions
+4 -4
View File
@@ -257,7 +257,7 @@ void SortIndustryTypes()
std::sort(_sorted_industry_types.begin(), _sorted_industry_types.end(), IndustryTypeNameSorter);
}
static constexpr NWidgetPart _nested_build_industry_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_build_industry_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_FUND_INDUSTRY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -1204,7 +1204,7 @@ static void UpdateIndustryProduction(Industry *i)
}
/** Widget definition of the view industry gui */
static constexpr NWidgetPart _nested_industry_view_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_industry_view_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_CREAM),
NWidget(WWT_CAPTION, COLOUR_CREAM, WID_IV_CAPTION),
@@ -1242,7 +1242,7 @@ void ShowIndustryViewWindow(IndustryID industry)
}
/** Widget definition of the industry directory gui */
static constexpr NWidgetPart _nested_industry_directory_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_industry_directory_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_ID_CAPTION),
@@ -1931,7 +1931,7 @@ void ShowIndustryDirectory()
}
/** Widgets of the industry cargoes window. */
static constexpr NWidgetPart _nested_industry_cargoes_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_industry_cargoes_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_IC_CAPTION),