Codechange: Make all NWidgetPart arrays constexpr.

This ensures that the arrays are not created at runtime and prevents using non-constexpr values.
This commit is contained in:
Peter Nelson
2024-01-15 22:49:24 +00:00
committed by Peter Nelson
parent 71b7ba0daa
commit 7737aa6640
61 changed files with 154 additions and 154 deletions

View File

@@ -732,7 +732,7 @@ static std::unique_ptr<NWidgetBase> CargoWidgets()
return container;
}
static const NWidgetPart _nested_company_stations_widgets[] = {
static constexpr NWidgetPart _nested_company_stations_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_STL_CAPTION), SetDataTip(STR_STATION_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -786,7 +786,7 @@ void ShowCompanyStations(CompanyID company)
AllocateWindowDescFront<CompanyStationsWindow>(&_company_stations_desc, company);
}
static const NWidgetPart _nested_station_view_widgets[] = {
static constexpr NWidgetPart _nested_station_view_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_SV_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_STATION_VIEW_RENAME_TOOLTIP),
@@ -2252,7 +2252,7 @@ static const T *FindStationsNearby(TileArea ta, bool distant_join)
return nullptr;
}
static const NWidgetPart _nested_select_station_widgets[] = {
static constexpr NWidgetPart _nested_select_station_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN, WID_JS_CAPTION), SetDataTip(STR_JOIN_STATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),