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:

committed by
Peter Nelson

parent
71b7ba0daa
commit
7737aa6640
@@ -1207,7 +1207,7 @@ struct RefitWindow : public Window {
|
||||
}
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_vehicle_refit_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_vehicle_refit_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VR_CAPTION), SetDataTip(STR_REFIT_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
@@ -1495,7 +1495,7 @@ void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index)
|
||||
ChangeVehicleWindow(WC_VEHICLE_TIMETABLE, from_index, to_index);
|
||||
}
|
||||
|
||||
static const NWidgetPart _nested_vehicle_list[] = {
|
||||
static constexpr NWidgetPart _nested_vehicle_list[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VL_CAPTION_SELECTION),
|
||||
@@ -2232,7 +2232,7 @@ static_assert(WID_VD_DETAILS_CAPACITY_OF_EACH == WID_VD_DETAILS_CARGO_CARRIED +
|
||||
static_assert(WID_VD_DETAILS_TOTAL_CARGO == WID_VD_DETAILS_CARGO_CARRIED + TDW_TAB_TOTALS );
|
||||
|
||||
/** Vehicle details widgets (other than train). */
|
||||
static const NWidgetPart _nested_nontrain_vehicle_details_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_nontrain_vehicle_details_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_VEHICLE_DETAILS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
@@ -2255,7 +2255,7 @@ static const NWidgetPart _nested_nontrain_vehicle_details_widgets[] = {
|
||||
};
|
||||
|
||||
/** Train details widgets. */
|
||||
static const NWidgetPart _nested_train_vehicle_details_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_train_vehicle_details_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_VD_CAPTION), SetDataTip(STR_VEHICLE_DETAILS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
@@ -2693,7 +2693,7 @@ static void ShowVehicleDetailsWindow(const Vehicle *v)
|
||||
/* Unified vehicle GUI - Vehicle View Window */
|
||||
|
||||
/** Vehicle view widgets. */
|
||||
static const NWidgetPart _nested_vehicle_view_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_vehicle_view_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_RENAME), SetMinimalSize(12, 14), SetDataTip(SPR_RENAME, STR_NULL /* filled in later */),
|
||||
|
Reference in New Issue
Block a user