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

@@ -627,7 +627,7 @@ struct NewGRFInspectWindow : Window {
/* static */ uint32_t NewGRFInspectWindow::var60params[GSF_FAKE_END][0x20] = { {0} }; // Use spec to have 0s in whole array
static constexpr NWidgetPart _nested_newgrf_inspect_chain_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_inspect_chain_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetStringTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -651,7 +651,7 @@ static constexpr NWidgetPart _nested_newgrf_inspect_chain_widgets[] = {
EndContainer(),
};
static constexpr NWidgetPart _nested_newgrf_inspect_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_newgrf_inspect_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_NGRFI_CAPTION), SetStringTip(STR_NEWGRF_INSPECT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -1122,7 +1122,7 @@ private:
bool SpriteAlignerWindow::centre = true;
bool SpriteAlignerWindow::crosshair = true;
static constexpr NWidgetPart _nested_sprite_aligner_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_sprite_aligner_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_SA_CAPTION),