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
@@ -48,7 +48,7 @@ enum OskActivation {
|
||||
};
|
||||
|
||||
|
||||
static const NWidgetPart _nested_land_info_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_land_info_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_LAND_AREA_INFORMATION_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
@@ -377,7 +377,7 @@ void ShowLandInfo(TileIndex tile)
|
||||
new LandInfoWindow(tile);
|
||||
}
|
||||
|
||||
static const NWidgetPart _nested_about_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_about_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_ABOUT_OPENTTD, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
@@ -647,7 +647,7 @@ void HideFillingPercent(TextEffectID *te_id)
|
||||
*te_id = INVALID_TE_ID;
|
||||
}
|
||||
|
||||
static const NWidgetPart _nested_tooltips_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_tooltips_widgets[] = {
|
||||
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_TT_BACKGROUND),
|
||||
};
|
||||
|
||||
@@ -1048,7 +1048,7 @@ struct QueryStringWindow : public Window
|
||||
}
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_query_string_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_query_string_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY, WID_QS_CAPTION), SetDataTip(STR_JUST_STRING, STR_NULL), SetTextStyle(TC_WHITE),
|
||||
@@ -1195,7 +1195,7 @@ struct QueryWindow : public Window {
|
||||
}
|
||||
};
|
||||
|
||||
static const NWidgetPart _nested_query_widgets[] = {
|
||||
static constexpr NWidgetPart _nested_query_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_RED),
|
||||
NWidget(WWT_CAPTION, COLOUR_RED, WID_Q_CAPTION), // The caption's string is set in the constructor
|
||||
|
Reference in New Issue
Block a user