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

@@ -279,7 +279,7 @@ static void DrawYearColumn(const Rect &r, TimerGameCalendar::Year year, const Ex
DrawPrice(sum, r.left, r.right, y, TC_WHITE);
}
static const NWidgetPart _nested_company_finances_widgets[] = {
static constexpr NWidgetPart _nested_company_finances_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_CF_CAPTION), SetDataTip(STR_FINANCES_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -1097,7 +1097,7 @@ public:
}
};
static const NWidgetPart _nested_select_company_livery_widgets[] = {
static constexpr NWidgetPart _nested_select_company_livery_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCL_CAPTION), SetDataTip(STR_LIVERY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -1192,7 +1192,7 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, const Rect &r)
}
/** Nested widget description for the company manager face selection dialog */
static const NWidgetPart _nested_select_company_manager_face_widgets[] = {
static constexpr NWidgetPart _nested_select_company_manager_face_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_SCMF_CAPTION), SetDataTip(STR_FACE_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -1771,7 +1771,7 @@ static void DoSelectCompanyManagerFace(Window *parent)
new SelectCompanyManagerFaceWindow(&_select_company_manager_face_desc, parent);
}
static const NWidgetPart _nested_company_infrastructure_widgets[] = {
static constexpr NWidgetPart _nested_company_infrastructure_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_CI_CAPTION), SetDataTip(STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -2140,7 +2140,7 @@ static void ShowCompanyInfrastructure(CompanyID company)
AllocateWindowDescFront<CompanyInfrastructureWindow>(&_company_infrastructure_desc, company);
}
static const NWidgetPart _nested_company_widgets[] = {
static constexpr NWidgetPart _nested_company_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
NWidget(WWT_CAPTION, COLOUR_GREY, WID_C_CAPTION), SetDataTip(STR_COMPANY_VIEW_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
@@ -2726,7 +2726,7 @@ private:
Money company_value; ///< The value of the company for which the user can buy it.
};
static const NWidgetPart _nested_buy_company_widgets[] = {
static constexpr NWidgetPart _nested_buy_company_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_BC_CAPTION), SetDataTip(STR_ERROR_MESSAGE_CAPTION_OTHER_COMPANY, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),