From 448d6ede4ae392f31c68e379229271cd44c700ec Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 1 Jan 2025 20:17:20 +0000 Subject: [PATCH] Codechange: Use STR_NULL (or {}) instead of literal 0. (#13222) --- src/framerate_gui.cpp | 2 +- src/newgrf_config.h | 2 +- src/script/script_gui.cpp | 2 +- src/settings_gui.cpp | 2 +- src/station_gui.cpp | 2 +- src/vehicle_gui.cpp | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index dc894de4a8..45bbf86106 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -396,7 +396,7 @@ static constexpr NWidgetPart _framerate_window_widgets[] = { NWidget(WWT_EMPTY, INVALID_COLOUR, WID_FRW_TIMES_AVERAGE), SetScrollbar(WID_FRW_SCROLLBAR), NWidget(WWT_EMPTY, INVALID_COLOUR, WID_FRW_ALLOCSIZE), SetScrollbar(WID_FRW_SCROLLBAR), EndContainer(), - NWidget(WWT_TEXT, INVALID_COLOUR, WID_FRW_INFO_DATA_POINTS), SetDataTip(STR_FRAMERATE_DATA_POINTS, 0x0), SetFill(1, 0), SetResize(1, 0), + NWidget(WWT_TEXT, INVALID_COLOUR, WID_FRW_INFO_DATA_POINTS), SetDataTip(STR_FRAMERATE_DATA_POINTS, STR_NULL), SetFill(1, 0), SetResize(1, 0), EndContainer(), EndContainer(), NWidget(NWID_VERTICAL), diff --git a/src/newgrf_config.h b/src/newgrf_config.h index cab22aa6ec..aae6f03de1 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -106,7 +106,7 @@ struct GRFIdentifier { /** Information about why GRF had problems during initialisation */ struct GRFError { - GRFError(StringID severity, StringID message = 0); + GRFError(StringID severity, StringID message = {}); std::string custom_message{}; ///< Custom message (if present) std::string data{}; ///< Additional data for message and custom_message diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index a5e5f47c6d..3a9c4458dc 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -1269,7 +1269,7 @@ static constexpr NWidgetPart _nested_script_debug_widgets[] = { NWidget(WWT_IMGBTN_2, COLOUR_GREY, WID_SCRD_BREAK_STR_ON_OFF_BTN), SetAspect(WidgetDimensions::ASPECT_VEHICLE_FLAG), SetFill(0, 1), SetDataTip(SPR_FLAG_VEH_STOPPED, STR_AI_DEBUG_BREAK_STR_ON_OFF_TOOLTIP), NWidget(WWT_PANEL, COLOUR_GREY), NWidget(NWID_HORIZONTAL), - NWidget(WWT_LABEL, INVALID_COLOUR), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, 0x0), + NWidget(WWT_LABEL, INVALID_COLOUR), SetPadding(2, 2, 2, 4), SetDataTip(STR_AI_DEBUG_BREAK_ON_LABEL, STR_NULL), NWidget(WWT_EDITBOX, COLOUR_GREY, WID_SCRD_BREAK_STR_EDIT_BOX), SetFill(1, 1), SetResize(1, 0), SetPadding(2, 2, 2, 2), SetDataTip(STR_AI_DEBUG_BREAK_STR_OSKTITLE, STR_AI_DEBUG_BREAK_STR_TOOLTIP), EndContainer(), EndContainer(), diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 043a2d0296..0a947d21e9 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -3051,7 +3051,7 @@ struct CustomCurrencyWindow : Window { { int line = 0; int len = 0; - StringID str = 0; + StringID str = STR_NULL; CharSetFilter afilter = CS_ALPHANUMERAL; switch (widget) { diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 080e0543ba..d2b7e9b546 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -829,7 +829,7 @@ static constexpr NWidgetPart _nested_station_view_widgets[] = { NWidget(WWT_STICKYBOX, COLOUR_GREY), EndContainer(), NWidget(NWID_HORIZONTAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SV_GROUP), SetMinimalSize(81, 12), SetFill(1, 1), SetDataTip(STR_STATION_VIEW_GROUP, 0x0), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_SV_GROUP), SetMinimalSize(81, 12), SetFill(1, 1), SetDataTip(STR_STATION_VIEW_GROUP, STR_NULL), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_SV_GROUP_BY), SetMinimalSize(168, 12), SetResize(1, 0), SetFill(0, 1), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), EndContainer(), NWidget(NWID_HORIZONTAL), diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index e8d60d6649..64311a4077 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2906,19 +2906,19 @@ static constexpr NWidgetPart _nested_vehicle_view_widgets[] = { EndContainer(), NWidget(NWID_VERTICAL), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VV_SELECT_DEPOT_CLONE), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_GOTO_DEPOT), SetMinimalSize(18, 18), SetDataTip(0x0 /* filled later */, 0x0 /* filled later */), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_CLONE), SetMinimalSize(18, 18), SetDataTip(0x0 /* filled later */, 0x0 /* filled later */), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_GOTO_DEPOT), SetMinimalSize(18, 18), SetDataTip(0x0 /* filled later */, STR_NULL /* filled later */), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_CLONE), SetMinimalSize(18, 18), SetDataTip(0x0 /* filled later */, STR_NULL /* filled later */), EndContainer(), /* For trains only, 'ignore signal' button. */ NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_FORCE_PROCEED), SetMinimalSize(18, 18), SetDataTip(SPR_IGNORE_SIGNALS, STR_VEHICLE_VIEW_TRAIN_IGNORE_SIGNAL_TOOLTIP), NWidget(NWID_SELECTION, INVALID_COLOUR, WID_VV_SELECT_REFIT_TURN), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_REFIT), SetMinimalSize(18, 18), SetDataTip(SPR_REFIT_VEHICLE, 0x0 /* filled later */), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_REFIT), SetMinimalSize(18, 18), SetDataTip(SPR_REFIT_VEHICLE, STR_NULL /* filled later */), NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_TURN_AROUND), SetMinimalSize(18, 18), SetDataTip(SPR_FORCE_VEHICLE_TURN, STR_VEHICLE_VIEW_ROAD_VEHICLE_REVERSE_TOOLTIP), EndContainer(), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_SHOW_ORDERS), SetMinimalSize(18, 18), SetDataTip(SPR_SHOW_ORDERS, 0x0 /* filled later */), - NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_SHOW_DETAILS), SetMinimalSize(18, 18), SetDataTip(SPR_SHOW_VEHICLE_DETAILS, 0x0 /* filled later */), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_SHOW_ORDERS), SetMinimalSize(18, 18), SetDataTip(SPR_SHOW_ORDERS, STR_NULL /* filled later */), + NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_VV_SHOW_DETAILS), SetMinimalSize(18, 18), SetDataTip(SPR_SHOW_VEHICLE_DETAILS, STR_NULL /* filled later */), NWidget(WWT_PANEL, COLOUR_GREY), SetMinimalSize(18, 0), SetResize(0, 1), EndContainer(), EndContainer(), EndContainer(),