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

@@ -787,7 +787,7 @@ const std::initializer_list<GUIStationList::SortFunction * const> CompanyStation
&StationRatingMinSorter
};
static constexpr NWidgetPart _nested_company_stations_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_company_stations_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_STL_CAPTION),
@@ -839,7 +839,7 @@ void ShowCompanyStations(CompanyID company)
AllocateWindowDescFront<CompanyStationsWindow>(_company_stations_desc, company);
}
static constexpr NWidgetPart _nested_station_view_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_station_view_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SV_RENAME), SetAspect(WidgetDimensions::ASPECT_RENAME), SetSpriteTip(SPR_RENAME, STR_STATION_VIEW_RENAME_TOOLTIP),
@@ -2321,7 +2321,7 @@ static void FindStationsNearby(TileArea ta, bool distant_join)
}
}
static constexpr NWidgetPart _nested_select_station_widgets[] = {
static constexpr std::initializer_list<NWidgetPart> _nested_select_station_widgets = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_JS_CAPTION), SetStringTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),