diff --git a/.github/windowdesc-ini-key.py b/.github/windowdesc-ini-key.py index 16fa3053d8..36b20f9948 100644 --- a/.github/windowdesc-ini-key.py +++ b/.github/windowdesc-ini-key.py @@ -22,7 +22,7 @@ def scan_source_files(path, ini_keys=None): with open(new_path) as fp: output = fp.read() - for (name, ini_key, widgets) in re.findall(r"^static WindowDesc ([a-zA-Z0-9_]*).*?, (?:\"(.*?)\")?.*?,(?:\s+(.*?),){6}", output, re.S|re.M): + for (name, ini_key, widgets) in re.findall(r"^static WindowDesc ([a-zA-Z0-9_]*).*?, (?:\"(.*?)\")?.*?,(?:\s+.*?,){6}\s+[^\s]+\((.*?)\)", output, re.S|re.M): if ini_key: if ini_key in ini_keys: errors.append(f"{new_path}: {name} ini_key is a duplicate") diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index a74586246d..b3125e8c2e 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -77,7 +77,7 @@ static WindowDesc _ai_config_desc( WDP_CENTER, "settings_script_config", 0, 0, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_ai_config_widgets, lengthof(_nested_ai_config_widgets) + std::begin(_nested_ai_config_widgets), std::end(_nested_ai_config_widgets) ); /** diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index fe0e6f7f39..ac9b0448e3 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -213,7 +213,7 @@ static WindowDesc _air_toolbar_desc( WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_air_toolbar_widgets, lengthof(_nested_air_toolbar_widgets), + std::begin(_nested_air_toolbar_widgets), std::end(_nested_air_toolbar_widgets), &BuildAirToolbarWindow::hotkeys ); @@ -622,7 +622,7 @@ static WindowDesc _build_airport_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_airport_widgets, lengthof(_nested_build_airport_widgets) + std::begin(_nested_build_airport_widgets), std::end(_nested_build_airport_widgets) ); static void ShowBuildAirportPicker(Window *parent) diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 1be79d5aee..8b342ca712 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -808,7 +808,7 @@ static WindowDesc _replace_rail_vehicle_desc( WDP_AUTO, "replace_vehicle_train", 500, 140, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, - _nested_replace_rail_vehicle_widgets, lengthof(_nested_replace_rail_vehicle_widgets) + std::begin(_nested_replace_rail_vehicle_widgets), std::end(_nested_replace_rail_vehicle_widgets) ); static const NWidgetPart _nested_replace_road_vehicle_widgets[] = { @@ -866,7 +866,7 @@ static WindowDesc _replace_road_vehicle_desc( WDP_AUTO, "replace_vehicle_road", 500, 140, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, - _nested_replace_road_vehicle_widgets, lengthof(_nested_replace_road_vehicle_widgets) + std::begin(_nested_replace_road_vehicle_widgets), std::end(_nested_replace_road_vehicle_widgets) ); static const NWidgetPart _nested_replace_vehicle_widgets[] = { @@ -920,7 +920,7 @@ static WindowDesc _replace_vehicle_desc( WDP_AUTO, "replace_vehicle", 456, 118, WC_REPLACE_VEHICLE, WC_NONE, WDF_CONSTRUCTION, - _nested_replace_vehicle_widgets, lengthof(_nested_replace_vehicle_widgets) + std::begin(_nested_replace_vehicle_widgets), std::end(_nested_replace_vehicle_widgets) ); /** diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 063e908a32..386883c1e2 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -43,7 +43,7 @@ static WindowDesc _background_desc( WDP_MANUAL, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, WDF_NO_CLOSE, - _background_widgets, lengthof(_background_widgets) + std::begin(_background_widgets), std::end(_background_widgets) ); /** The background for the game. */ @@ -81,7 +81,7 @@ static WindowDesc _bootstrap_errmsg_desc( WDP_CENTER, nullptr, 0, 0, WC_BOOTSTRAP, WC_NONE, WDF_MODAL | WDF_NO_CLOSE, - _nested_bootstrap_errmsg_widgets, lengthof(_nested_bootstrap_errmsg_widgets) + std::begin(_nested_bootstrap_errmsg_widgets), std::end(_nested_bootstrap_errmsg_widgets) ); /** The window for a failed bootstrap. */ @@ -138,7 +138,7 @@ static WindowDesc _bootstrap_download_status_window_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL | WDF_NO_CLOSE, - _nested_bootstrap_download_status_window_widgets, lengthof(_nested_bootstrap_download_status_window_widgets) + std::begin(_nested_bootstrap_download_status_window_widgets), std::end(_nested_bootstrap_download_status_window_widgets) ); @@ -192,7 +192,7 @@ static WindowDesc _bootstrap_query_desc( WDP_CENTER, nullptr, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, WDF_NO_CLOSE, - _bootstrap_query_widgets, lengthof(_bootstrap_query_widgets) + std::begin(_bootstrap_query_widgets), std::end(_bootstrap_query_widgets) ); /** The window for the query. It can't use the generic query window as that uses sprites that don't exist yet. */ diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index a463f51537..367e634411 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -346,7 +346,7 @@ static WindowDesc _build_bridge_desc( WDP_AUTO, "build_bridge", 200, 114, WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_bridge_widgets, lengthof(_nested_build_bridge_widgets) + std::begin(_nested_build_bridge_widgets), std::end(_nested_build_bridge_widgets) ); /** diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 86563ad8d9..7c5a259933 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1885,7 +1885,7 @@ static WindowDesc _build_vehicle_desc( WDP_AUTO, "build_vehicle", 240, 268, WC_BUILD_VEHICLE, WC_NONE, WDF_CONSTRUCTION, - _nested_build_vehicle_widgets, lengthof(_nested_build_vehicle_widgets), + std::begin(_nested_build_vehicle_widgets), std::end(_nested_build_vehicle_widgets), &BuildVehicleWindow::hotkeys ); diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 5e5c97c98b..e058a27cf7 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -432,7 +432,7 @@ static WindowDesc _cheats_desc( WDP_AUTO, "cheats", 0, 0, WC_CHEATS, WC_NONE, 0, - _nested_cheat_widgets, lengthof(_nested_cheat_widgets) + std::begin(_nested_cheat_widgets), std::end(_nested_cheat_widgets) ); /** Open cheat window. */ diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 409c57a276..45ca97f8e3 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -542,7 +542,7 @@ static WindowDesc _company_finances_desc( WDP_AUTO, "company_finances", 0, 0, WC_FINANCES, WC_NONE, 0, - _nested_company_finances_widgets, lengthof(_nested_company_finances_widgets) + std::begin(_nested_company_finances_widgets), std::end(_nested_company_finances_widgets) ); /** @@ -1160,7 +1160,7 @@ static WindowDesc _select_company_livery_desc( WDP_AUTO, nullptr, 0, 0, WC_COMPANY_COLOUR, WC_NONE, 0, - _nested_select_company_livery_widgets, lengthof(_nested_select_company_livery_widgets) + std::begin(_nested_select_company_livery_widgets), std::end(_nested_select_company_livery_widgets) ); void ShowCompanyLiveryWindow(CompanyID company, GroupID group) @@ -1777,7 +1777,7 @@ static WindowDesc _select_company_manager_face_desc( WDP_AUTO, nullptr, 0, 0, WC_COMPANY_MANAGER_FACE, WC_NONE, WDF_CONSTRUCTION, - _nested_select_company_manager_face_widgets, lengthof(_nested_select_company_manager_face_widgets) + std::begin(_nested_select_company_manager_face_widgets), std::end(_nested_select_company_manager_face_widgets) ); /** @@ -2149,7 +2149,7 @@ static WindowDesc _company_infrastructure_desc( WDP_AUTO, "company_infrastructure", 0, 0, WC_COMPANY_INFRASTRUCTURE, WC_NONE, 0, - _nested_company_infrastructure_widgets, lengthof(_nested_company_infrastructure_widgets) + std::begin(_nested_company_infrastructure_widgets), std::end(_nested_company_infrastructure_widgets) ); /** @@ -2686,7 +2686,7 @@ static WindowDesc _company_desc( WDP_AUTO, "company", 0, 0, WC_COMPANY, WC_NONE, 0, - _nested_company_widgets, lengthof(_nested_company_widgets) + std::begin(_nested_company_widgets), std::end(_nested_company_widgets) ); /** @@ -2820,7 +2820,7 @@ static WindowDesc _buy_company_desc( WDP_AUTO, nullptr, 0, 0, WC_BUY_COMPANY, WC_NONE, WDF_CONSTRUCTION, - _nested_buy_company_widgets, lengthof(_nested_buy_company_widgets) + std::begin(_nested_buy_company_widgets), std::end(_nested_buy_company_widgets) ); /** diff --git a/src/console_gui.cpp b/src/console_gui.cpp index ce2c0df758..3fc5e68288 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -106,7 +106,7 @@ static WindowDesc _console_window_desc( WDP_MANUAL, nullptr, 0, 0, WC_CONSOLE, WC_NONE, 0, - _nested_console_window_widgets, lengthof(_nested_console_window_widgets) + std::begin(_nested_console_window_widgets), std::end(_nested_console_window_widgets) ); struct IConsoleWindow : Window diff --git a/src/date_gui.cpp b/src/date_gui.cpp index febf505836..cc012f545b 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -200,7 +200,7 @@ static WindowDesc _set_date_desc( WDP_CENTER, nullptr, 0, 0, WC_SET_DATE, WC_NONE, 0, - _nested_set_date_widgets, lengthof(_nested_set_date_widgets) + std::begin(_nested_set_date_widgets), std::end(_nested_set_date_widgets) ); /** diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index b7fb593a45..4a7ada72fb 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -89,28 +89,28 @@ static WindowDesc _train_depot_desc( WDP_AUTO, "depot_train", 362, 123, WC_VEHICLE_DEPOT, WC_NONE, 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) + std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets) ); static WindowDesc _road_depot_desc( WDP_AUTO, "depot_roadveh", 316, 97, WC_VEHICLE_DEPOT, WC_NONE, 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) + std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets) ); static WindowDesc _ship_depot_desc( WDP_AUTO, "depot_ship", 306, 99, WC_VEHICLE_DEPOT, WC_NONE, 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) + std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets) ); static WindowDesc _aircraft_depot_desc( WDP_AUTO, "depot_aircraft", 332, 99, WC_VEHICLE_DEPOT, WC_NONE, 0, - _nested_train_depot_widgets, lengthof(_nested_train_depot_widgets) + std::begin(_nested_train_depot_widgets), std::end(_nested_train_depot_widgets) ); extern void DepotSortList(VehicleList *list); diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 6bdaa75d38..f2a4d60305 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -349,7 +349,7 @@ static WindowDesc _build_docks_toolbar_desc( WDP_ALIGN_TOOLBAR, "toolbar_water", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_docks_toolbar_widgets, lengthof(_nested_build_docks_toolbar_widgets), + std::begin(_nested_build_docks_toolbar_widgets), std::end(_nested_build_docks_toolbar_widgets), &BuildDocksToolbarWindow::hotkeys ); @@ -393,7 +393,7 @@ static WindowDesc _build_docks_scen_toolbar_desc( WDP_AUTO, "toolbar_water_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_docks_scen_toolbar_widgets, lengthof(_nested_build_docks_scen_toolbar_widgets) + std::begin(_nested_build_docks_scen_toolbar_widgets), std::end(_nested_build_docks_scen_toolbar_widgets) ); /** @@ -499,7 +499,7 @@ static WindowDesc _build_dock_station_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_dock_station_widgets, lengthof(_nested_build_dock_station_widgets) + std::begin(_nested_build_dock_station_widgets), std::end(_nested_build_dock_station_widgets) ); static void ShowBuildDockStationPicker(Window *parent) @@ -597,7 +597,7 @@ static WindowDesc _build_docks_depot_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_docks_depot_widgets, lengthof(_nested_build_docks_depot_widgets) + std::begin(_nested_build_docks_depot_widgets), std::end(_nested_build_docks_depot_widgets) ); diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index d909196b8c..ea580ffe31 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -147,7 +147,7 @@ static WindowDesc _engine_preview_desc( WDP_CENTER, nullptr, 0, 0, WC_ENGINE_PREVIEW, WC_NONE, WDF_CONSTRUCTION, - _nested_engine_preview_widgets, lengthof(_nested_engine_preview_widgets) + std::begin(_nested_engine_preview_widgets), std::end(_nested_engine_preview_widgets) ); diff --git a/src/error_gui.cpp b/src/error_gui.cpp index 7702b43578..2aacc1eed8 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -46,7 +46,7 @@ static WindowDesc _errmsg_desc( WDP_MANUAL, nullptr, 0, 0, WC_ERRMSG, WC_NONE, 0, - _nested_errmsg_widgets, lengthof(_nested_errmsg_widgets) + std::begin(_nested_errmsg_widgets), std::end(_nested_errmsg_widgets) ); static const NWidgetPart _nested_errmsg_face_widgets[] = { @@ -66,7 +66,7 @@ static WindowDesc _errmsg_face_desc( WDP_MANUAL, nullptr, 0, 0, WC_ERRMSG, WC_NONE, 0, - _nested_errmsg_face_widgets, lengthof(_nested_errmsg_face_widgets) + std::begin(_nested_errmsg_face_widgets), std::end(_nested_errmsg_face_widgets) ); /** diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 67883c9a9c..8eb5c7255a 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -887,7 +887,7 @@ static WindowDesc _load_dialog_desc( WDP_CENTER, "load_game", 500, 294, WC_SAVELOAD, WC_NONE, 0, - _nested_load_dialog_widgets, lengthof(_nested_load_dialog_widgets) + std::begin(_nested_load_dialog_widgets), std::end(_nested_load_dialog_widgets) ); /** Load heightmap */ @@ -895,7 +895,7 @@ static WindowDesc _load_heightmap_dialog_desc( WDP_CENTER, "load_heightmap", 257, 320, WC_SAVELOAD, WC_NONE, 0, - _nested_load_heightmap_dialog_widgets, lengthof(_nested_load_heightmap_dialog_widgets) + std::begin(_nested_load_heightmap_dialog_widgets), std::end(_nested_load_heightmap_dialog_widgets) ); /** Save game/scenario */ @@ -903,7 +903,7 @@ static WindowDesc _save_dialog_desc( WDP_CENTER, "save_game", 500, 294, WC_SAVELOAD, WC_NONE, 0, - _nested_save_dialog_widgets, lengthof(_nested_save_dialog_widgets) + std::begin(_nested_save_dialog_widgets), std::end(_nested_save_dialog_widgets) ); /** diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 7b416e750e..453d9f142f 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -730,7 +730,7 @@ static WindowDesc _framerate_display_desc( WDP_AUTO, "framerate_display", 0, 0, WC_FRAMERATE_DISPLAY, WC_NONE, 0, - _framerate_window_widgets, lengthof(_framerate_window_widgets) + std::begin(_framerate_window_widgets), std::end(_framerate_window_widgets) ); @@ -1015,7 +1015,7 @@ static WindowDesc _frametime_graph_window_desc( WDP_AUTO, "frametime_graph", 140, 90, WC_FRAMETIME_GRAPH, WC_NONE, 0, - _frametime_graph_window_widgets, lengthof(_frametime_graph_window_widgets) + std::begin(_frametime_graph_window_widgets), std::end(_frametime_graph_window_widgets) ); diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index f926409086..6a1c89596d 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -72,7 +72,7 @@ static WindowDesc _gs_config_desc( WDP_CENTER, "settings_gs_config", 500, 350, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_gs_config_widgets, lengthof(_nested_gs_config_widgets) + std::begin(_nested_gs_config_widgets), std::end(_nested_gs_config_widgets) ); /** diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 669e597f78..294b60c55e 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -1025,14 +1025,14 @@ static WindowDesc _generate_landscape_desc( WDP_CENTER, nullptr, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, - _nested_generate_landscape_widgets, lengthof(_nested_generate_landscape_widgets) + std::begin(_nested_generate_landscape_widgets), std::end(_nested_generate_landscape_widgets) ); static WindowDesc _heightmap_load_desc( WDP_CENTER, nullptr, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, - _nested_heightmap_load_widgets, lengthof(_nested_heightmap_load_widgets) + std::begin(_nested_heightmap_load_widgets), std::end(_nested_heightmap_load_widgets) ); static void _ShowGenerateLandscape(GenerateLandscapeWindowMode mode) @@ -1328,7 +1328,7 @@ static WindowDesc _create_scenario_desc( WDP_CENTER, nullptr, 0, 0, WC_GENERATE_LANDSCAPE, WC_NONE, 0, - _nested_create_scenario_widgets, lengthof(_nested_create_scenario_widgets) + std::begin(_nested_create_scenario_widgets), std::end(_nested_create_scenario_widgets) ); /** Show the window to create a scenario. */ @@ -1354,7 +1354,7 @@ static WindowDesc _generate_progress_desc( WDP_CENTER, nullptr, 0, 0, WC_MODAL_PROGRESS, WC_NONE, 0, - _nested_generate_progress_widgets, lengthof(_nested_generate_progress_widgets) + std::begin(_nested_generate_progress_widgets), std::end(_nested_generate_progress_widgets) ); struct GenWorldStatus { diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index bc640b0209..9ff4a32738 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -306,7 +306,7 @@ static WindowDesc _goals_list_desc( WDP_AUTO, "list_goals", 500, 127, WC_GOALS_LIST, WC_NONE, 0, - _nested_goals_list_widgets, lengthof(_nested_goals_list_widgets) + std::begin(_nested_goals_list_widgets), std::end(_nested_goals_list_widgets) ); /** @@ -521,25 +521,25 @@ static WindowDesc _goal_question_list_desc[] = { WDP_CENTER, nullptr, 0, 0, WC_GOAL_QUESTION, WC_NONE, WDF_CONSTRUCTION, - _nested_goal_question_widgets_question, lengthof(_nested_goal_question_widgets_question), + std::begin(_nested_goal_question_widgets_question), std::end(_nested_goal_question_widgets_question), }, { WDP_CENTER, nullptr, 0, 0, WC_GOAL_QUESTION, WC_NONE, WDF_CONSTRUCTION, - _nested_goal_question_widgets_info, lengthof(_nested_goal_question_widgets_info), + std::begin(_nested_goal_question_widgets_info), std::end(_nested_goal_question_widgets_info), }, { WDP_CENTER, nullptr, 0, 0, WC_GOAL_QUESTION, WC_NONE, WDF_CONSTRUCTION, - _nested_goal_question_widgets_warning, lengthof(_nested_goal_question_widgets_warning), + std::begin(_nested_goal_question_widgets_warning), std::end(_nested_goal_question_widgets_warning), }, { WDP_CENTER, nullptr, 0, 0, WC_GOAL_QUESTION, WC_NONE, WDF_CONSTRUCTION, - _nested_goal_question_widgets_error, lengthof(_nested_goal_question_widgets_error), + std::begin(_nested_goal_question_widgets_error), std::end(_nested_goal_question_widgets_error), }, }; diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index dba31fe4fe..91179e8286 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -145,7 +145,7 @@ static WindowDesc _graph_legend_desc( WDP_AUTO, "graph_legend", 0, 0, WC_GRAPH_LEGEND, WC_NONE, 0, - _nested_graph_legend_widgets, lengthof(_nested_graph_legend_widgets) + std::begin(_nested_graph_legend_widgets), std::end(_nested_graph_legend_widgets) ); static void ShowGraphLegend() @@ -658,7 +658,7 @@ static WindowDesc _operating_profit_desc( WDP_AUTO, "graph_operating_profit", 0, 0, WC_OPERATING_PROFIT, WC_NONE, 0, - _nested_operating_profit_widgets, lengthof(_nested_operating_profit_widgets) + std::begin(_nested_operating_profit_widgets), std::end(_nested_operating_profit_widgets) ); @@ -709,7 +709,7 @@ static WindowDesc _income_graph_desc( WDP_AUTO, "graph_income", 0, 0, WC_INCOME_GRAPH, WC_NONE, 0, - _nested_income_graph_widgets, lengthof(_nested_income_graph_widgets) + std::begin(_nested_income_graph_widgets), std::end(_nested_income_graph_widgets) ); void ShowIncomeGraph() @@ -758,7 +758,7 @@ static WindowDesc _delivered_cargo_graph_desc( WDP_AUTO, "graph_delivered_cargo", 0, 0, WC_DELIVERED_CARGO, WC_NONE, 0, - _nested_delivered_cargo_graph_widgets, lengthof(_nested_delivered_cargo_graph_widgets) + std::begin(_nested_delivered_cargo_graph_widgets), std::end(_nested_delivered_cargo_graph_widgets) ); void ShowDeliveredCargoGraph() @@ -814,7 +814,7 @@ static WindowDesc _performance_history_desc( WDP_AUTO, "graph_performance", 0, 0, WC_PERFORMANCE_HISTORY, WC_NONE, 0, - _nested_performance_history_widgets, lengthof(_nested_performance_history_widgets) + std::begin(_nested_performance_history_widgets), std::end(_nested_performance_history_widgets) ); void ShowPerformanceHistoryGraph() @@ -863,7 +863,7 @@ static WindowDesc _company_value_graph_desc( WDP_AUTO, "graph_company_value", 0, 0, WC_COMPANY_VALUE, WC_NONE, 0, - _nested_company_value_graph_widgets, lengthof(_nested_company_value_graph_widgets) + std::begin(_nested_company_value_graph_widgets), std::end(_nested_company_value_graph_widgets) ); void ShowCompanyValueGraph() @@ -1097,7 +1097,7 @@ static WindowDesc _cargo_payment_rates_desc( WDP_AUTO, "graph_cargo_payment_rates", 0, 0, WC_PAYMENT_RATES, WC_NONE, 0, - _nested_cargo_payment_rates_widgets, lengthof(_nested_cargo_payment_rates_widgets) + std::begin(_nested_cargo_payment_rates_widgets), std::end(_nested_cargo_payment_rates_widgets) ); @@ -1393,7 +1393,7 @@ static WindowDesc _performance_rating_detail_desc( WDP_AUTO, "league_details", 0, 0, WC_PERFORMANCE_DETAIL, WC_NONE, 0, - _nested_performance_rating_detail_widgets, lengthof(_nested_performance_rating_detail_widgets) + std::begin(_nested_performance_rating_detail_widgets), std::end(_nested_performance_rating_detail_widgets) ); void ShowPerformanceRatingDetail() diff --git a/src/group_gui.cpp b/src/group_gui.cpp index cb6959d379..721125d62a 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -1108,14 +1108,14 @@ static WindowDesc _other_group_desc( WDP_AUTO, "list_groups", 460, 246, WC_INVALID, WC_NONE, 0, - _nested_group_widgets, lengthof(_nested_group_widgets) + std::begin(_nested_group_widgets), std::end(_nested_group_widgets) ); static WindowDesc _train_group_desc( WDP_AUTO, "list_groups_train", 525, 246, WC_TRAINS_LIST, WC_NONE, 0, - _nested_group_widgets, lengthof(_nested_group_widgets) + std::begin(_nested_group_widgets), std::end(_nested_group_widgets) ); /** diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index ab6f3b3f52..4b55d65586 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -218,14 +218,14 @@ static WindowDesc _highscore_desc( WDP_MANUAL, nullptr, 0, 0, WC_HIGHSCORE, WC_NONE, 0, - _nested_highscore_widgets, lengthof(_nested_highscore_widgets) + std::begin(_nested_highscore_widgets), std::end(_nested_highscore_widgets) ); static WindowDesc _endgame_desc( WDP_MANUAL, nullptr, 0, 0, WC_ENDSCREEN, WC_NONE, 0, - _nested_highscore_widgets, lengthof(_nested_highscore_widgets) + std::begin(_nested_highscore_widgets), std::end(_nested_highscore_widgets) ); /** diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index cd72c4bc38..e68a6373d7 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -296,7 +296,7 @@ static WindowDesc _build_industry_desc( WDP_AUTO, "build_industry", 170, 212, WC_BUILD_INDUSTRY, WC_NONE, WDF_CONSTRUCTION, - _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets) + std::begin(_nested_build_industry_widgets), std::end(_nested_build_industry_widgets) ); /** Build (fund or prospect) a new industry, */ @@ -1206,7 +1206,7 @@ static WindowDesc _industry_view_desc( WDP_AUTO, "view_industry", 260, 120, WC_INDUSTRY_VIEW, WC_NONE, 0, - _nested_industry_view_widgets, lengthof(_nested_industry_view_widgets) + std::begin(_nested_industry_view_widgets), std::end(_nested_industry_view_widgets) ); void ShowIndustryViewWindow(int industry) @@ -1867,7 +1867,7 @@ static WindowDesc _industry_directory_desc( WDP_AUTO, "list_industries", 428, 190, WC_INDUSTRY_DIRECTORY, WC_NONE, 0, - _nested_industry_directory_widgets, lengthof(_nested_industry_directory_widgets) + std::begin(_nested_industry_directory_widgets), std::end(_nested_industry_directory_widgets) ); void ShowIndustryDirectory() @@ -1905,7 +1905,7 @@ static WindowDesc _industry_cargoes_desc( WDP_AUTO, "industry_cargoes", 300, 210, WC_INDUSTRY_CARGOES, WC_NONE, 0, - _nested_industry_cargoes_widgets, lengthof(_nested_industry_cargoes_widgets) + std::begin(_nested_industry_cargoes_widgets), std::end(_nested_industry_cargoes_widgets) ); /** Available types of field. */ diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 2c5acca26d..e5eef652f3 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -495,7 +495,7 @@ static WindowDesc _select_game_desc( WDP_CENTER, nullptr, 0, 0, WC_SELECT_GAME, WC_NONE, WDF_NO_CLOSE, - _nested_select_game_widgets, lengthof(_nested_select_game_widgets) + std::begin(_nested_select_game_widgets), std::end(_nested_select_game_widgets) ); void ShowSelectGameWindow() diff --git a/src/league_gui.cpp b/src/league_gui.cpp index 7a0b2c9b3b..f97a041604 100644 --- a/src/league_gui.cpp +++ b/src/league_gui.cpp @@ -200,7 +200,7 @@ static WindowDesc _performance_league_desc( WDP_AUTO, "performance_league", 0, 0, WC_COMPANY_LEAGUE, WC_NONE, 0, - _nested_performance_league_widgets, lengthof(_nested_performance_league_widgets) + std::begin(_nested_performance_league_widgets), std::end(_nested_performance_league_widgets) ); void ShowPerformanceLeagueTable() @@ -432,7 +432,7 @@ static WindowDesc _script_league_desc( WDP_AUTO, "script_league", 0, 0, WC_COMPANY_LEAGUE, WC_NONE, 0, - _nested_script_league_widgets, lengthof(_nested_script_league_widgets) + std::begin(_nested_script_league_widgets), std::end(_nested_script_league_widgets) ); void ShowScriptLeagueTable(LeagueTableID table) diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index 4289389519..abe892d81c 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -541,7 +541,7 @@ static WindowDesc _linkgraph_legend_desc( WDP_AUTO, "toolbar_linkgraph", 0, 0, WC_LINKGRAPH_LEGEND, WC_NONE, 0, - _nested_linkgraph_legend_widgets, lengthof(_nested_linkgraph_legend_widgets) + std::begin(_nested_linkgraph_legend_widgets), std::end(_nested_linkgraph_legend_widgets) ); /** diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 05ec1a5de0..d27976bbcc 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -511,7 +511,7 @@ static WindowDesc _main_window_desc( WDP_MANUAL, nullptr, 0, 0, WC_MAIN_WINDOW, WC_NONE, WDF_NO_CLOSE, - _nested_main_window_widgets, lengthof(_nested_main_window_widgets), + std::begin(_nested_main_window_widgets), std::end(_nested_main_window_widgets), &MainWindow::hotkeys ); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 9b6e894136..4a58104490 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -62,7 +62,7 @@ static WindowDesc _land_info_desc( WDP_AUTO, nullptr, 0, 0, WC_LAND_INFO, WC_NONE, 0, - _nested_land_info_widgets, lengthof(_nested_land_info_widgets) + std::begin(_nested_land_info_widgets), std::end(_nested_land_info_widgets) ); class LandInfoWindow : public Window { @@ -396,7 +396,7 @@ static WindowDesc _about_desc( WDP_CENTER, nullptr, 0, 0, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_about_widgets, lengthof(_nested_about_widgets) + std::begin(_nested_about_widgets), std::end(_nested_about_widgets) ); static const char * const _credits[] = { @@ -654,7 +654,7 @@ static WindowDesc _tool_tips_desc( WDP_MANUAL, nullptr, 0, 0, // Coordinates and sizes are not used, WC_TOOLTIPS, WC_NONE, WDF_NO_FOCUS | WDF_NO_CLOSE, - _nested_tooltips_widgets, lengthof(_nested_tooltips_widgets) + std::begin(_nested_tooltips_widgets), std::end(_nested_tooltips_widgets) ); /** Window for displaying a tooltip. */ @@ -1067,7 +1067,7 @@ static WindowDesc _query_string_desc( WDP_CENTER, nullptr, 0, 0, WC_QUERY_STRING, WC_NONE, 0, - _nested_query_string_widgets, lengthof(_nested_query_string_widgets) + std::begin(_nested_query_string_widgets), std::end(_nested_query_string_widgets) ); /** @@ -1214,7 +1214,7 @@ static WindowDesc _query_desc( WDP_CENTER, nullptr, 0, 0, WC_CONFIRM_POPUP_QUERY, WC_NONE, WDF_MODAL, - _nested_query_widgets, lengthof(_nested_query_widgets) + std::begin(_nested_query_widgets), std::end(_nested_query_widgets) ); /** diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 8cff204162..1f0d626377 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -645,7 +645,7 @@ static WindowDesc _music_track_selection_desc( WDP_AUTO, nullptr, 0, 0, WC_MUSIC_TRACK_SELECTION, WC_NONE, 0, - _nested_music_track_selection_widgets, lengthof(_nested_music_track_selection_widgets) + std::begin(_nested_music_track_selection_widgets), std::end(_nested_music_track_selection_widgets) ); static void ShowMusicTrackSelection() @@ -905,7 +905,7 @@ static WindowDesc _music_window_desc( WDP_AUTO, "music", 0, 0, WC_MUSIC_WINDOW, WC_NONE, 0, - _nested_music_window_widgets, lengthof(_nested_music_window_widgets) + std::begin(_nested_music_window_widgets), std::end(_nested_music_window_widgets) ); void ShowMusicWindow() diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index c9f0835c62..c43b44172a 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -510,7 +510,7 @@ static WindowDesc _chat_window_desc( WDP_MANUAL, nullptr, 0, 0, WC_SEND_NETWORK_MSG, WC_NONE, 0, - _nested_chat_window_widgets, lengthof(_nested_chat_window_widgets) + std::begin(_nested_chat_window_widgets), std::end(_nested_chat_window_widgets) ); diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 4b752c62f7..2572b8a7b2 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -96,7 +96,7 @@ static WindowDesc _network_content_download_status_window_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, - _nested_network_content_download_status_window_widgets, lengthof(_nested_network_content_download_status_window_widgets) + std::begin(_nested_network_content_download_status_window_widgets), std::end(_nested_network_content_download_status_window_widgets) ); BaseNetworkContentDownloadStatusWindow::BaseNetworkContentDownloadStatusWindow(WindowDesc *desc) : @@ -1113,7 +1113,7 @@ static WindowDesc _network_content_list_desc( WDP_CENTER, "list_content", 630, 460, WC_NETWORK_WINDOW, WC_NONE, 0, - _nested_network_content_list_widgets, lengthof(_nested_network_content_list_widgets) + std::begin(_nested_network_content_list_widgets), std::end(_nested_network_content_list_widgets) ); /** diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 0f6c5e2dca..0270f60713 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1007,7 +1007,7 @@ static WindowDesc _network_game_window_desc( WDP_CENTER, "list_servers", 1000, 730, WC_NETWORK_WINDOW, WC_NONE, 0, - _nested_network_game_widgets, lengthof(_nested_network_game_widgets) + std::begin(_nested_network_game_widgets), std::end(_nested_network_game_widgets) ); void ShowNetworkGameWindow() @@ -1280,7 +1280,7 @@ static WindowDesc _network_start_server_window_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_WINDOW, WC_NONE, 0, - _nested_network_start_server_window_widgets, lengthof(_nested_network_start_server_window_widgets) + std::begin(_nested_network_start_server_window_widgets), std::end(_nested_network_start_server_window_widgets) ); static void ShowNetworkStartServerWindow() @@ -1359,7 +1359,7 @@ static WindowDesc _client_list_desc( WDP_AUTO, "list_clients", 220, 300, WC_CLIENT_LIST, WC_NONE, 0, - _nested_client_list_widgets, lengthof(_nested_client_list_widgets) + std::begin(_nested_client_list_widgets), std::end(_nested_client_list_widgets) ); /** @@ -2274,7 +2274,7 @@ static WindowDesc _network_join_status_window_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_STATUS_WINDOW, WC_NONE, WDF_MODAL, - _nested_network_join_status_window_widgets, lengthof(_nested_network_join_status_window_widgets) + std::begin(_nested_network_join_status_window_widgets), std::end(_nested_network_join_status_window_widgets) ); void ShowJoinStatusWindow() @@ -2396,7 +2396,7 @@ static WindowDesc _network_company_password_window_desc( WDP_AUTO, nullptr, 0, 0, WC_COMPANY_PASSWORD_WINDOW, WC_NONE, 0, - _nested_network_company_password_window_widgets, lengthof(_nested_network_company_password_window_widgets) + std::begin(_nested_network_company_password_window_widgets), std::end(_nested_network_company_password_window_widgets) ); void ShowNetworkCompanyPasswordWindow(Window *parent) @@ -2499,7 +2499,7 @@ static WindowDesc _network_ask_relay_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_ASK_RELAY, WC_NONE, WDF_MODAL, - _nested_network_ask_relay_widgets, lengthof(_nested_network_ask_relay_widgets) + std::begin(_nested_network_ask_relay_widgets), std::end(_nested_network_ask_relay_widgets) ); /** @@ -2597,7 +2597,7 @@ static WindowDesc _network_ask_survey_desc( WDP_CENTER, nullptr, 0, 0, WC_NETWORK_ASK_SURVEY, WC_NONE, WDF_MODAL, - _nested_network_ask_survey_widgets, lengthof(_nested_network_ask_survey_widgets) + std::begin(_nested_network_ask_survey_widgets), std::end(_nested_network_ask_survey_widgets) ); /** diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index adfce85da9..afef4e9308 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -682,14 +682,14 @@ static WindowDesc _newgrf_inspect_chain_desc( WDP_AUTO, "newgrf_inspect_chain", 400, 300, WC_NEWGRF_INSPECT, WC_NONE, 0, - _nested_newgrf_inspect_chain_widgets, lengthof(_nested_newgrf_inspect_chain_widgets) + std::begin(_nested_newgrf_inspect_chain_widgets), std::end(_nested_newgrf_inspect_chain_widgets) ); static WindowDesc _newgrf_inspect_desc( WDP_AUTO, "newgrf_inspect", 400, 300, WC_NEWGRF_INSPECT, WC_NONE, 0, - _nested_newgrf_inspect_widgets, lengthof(_nested_newgrf_inspect_widgets) + std::begin(_nested_newgrf_inspect_widgets), std::end(_nested_newgrf_inspect_widgets) ); /** @@ -1124,7 +1124,7 @@ static WindowDesc _sprite_aligner_desc( WDP_AUTO, "sprite_aligner", 400, 300, WC_SPRITE_ALIGNER, WC_NONE, 0, - _nested_sprite_aligner_widgets, lengthof(_nested_sprite_aligner_widgets) + std::begin(_nested_sprite_aligner_widgets), std::end(_nested_sprite_aligner_widgets) ); /** diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 375cc0572d..8036a3f629 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -541,7 +541,7 @@ static WindowDesc _newgrf_parameters_desc( WDP_CENTER, "settings_newgrf_config", 500, 208, WC_GRF_PARAMETERS, WC_NONE, 0, - _nested_newgrf_parameter_widgets, lengthof(_nested_newgrf_parameter_widgets) + std::begin(_nested_newgrf_parameter_widgets), std::end(_nested_newgrf_parameter_widgets) ); static void OpenGRFParameterWindow(GRFConfig *c, bool editable) @@ -1926,13 +1926,13 @@ static const NWidgetPart _nested_newgrf_infopanel_widgets[] = { /** Construct nested container widget for managing the lists and the info panel of the NewGRF GUI. */ NWidgetBase* NewGRFDisplay(int *biggest_index) { - NWidgetBase *avs = MakeNWidgets(_nested_newgrf_availables_widgets, lengthof(_nested_newgrf_availables_widgets), biggest_index, nullptr); + NWidgetBase *avs = MakeNWidgets(std::begin(_nested_newgrf_availables_widgets), std::end(_nested_newgrf_availables_widgets), biggest_index, nullptr); int biggest2; - NWidgetBase *acs = MakeNWidgets(_nested_newgrf_actives_widgets, lengthof(_nested_newgrf_actives_widgets), &biggest2, nullptr); + NWidgetBase *acs = MakeNWidgets(std::begin(_nested_newgrf_actives_widgets), std::end(_nested_newgrf_actives_widgets), &biggest2, nullptr); *biggest_index = std::max(*biggest_index, biggest2); - NWidgetBase *inf = MakeNWidgets(_nested_newgrf_infopanel_widgets, lengthof(_nested_newgrf_infopanel_widgets), &biggest2, nullptr); + NWidgetBase *inf = MakeNWidgets(std::begin(_nested_newgrf_infopanel_widgets), std::end(_nested_newgrf_infopanel_widgets), &biggest2, nullptr); *biggest_index = std::max(*biggest_index, biggest2); return new NWidgetNewGRFDisplay(avs, acs, inf); @@ -1960,7 +1960,7 @@ static WindowDesc _newgrf_desc( WDP_CENTER, "settings_newgrf", 300, 263, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_newgrf_widgets, lengthof(_nested_newgrf_widgets) + std::begin(_nested_newgrf_widgets), std::end(_nested_newgrf_widgets) ); /** @@ -2044,7 +2044,7 @@ static WindowDesc _save_preset_desc( WDP_CENTER, "save_preset", 140, 110, WC_SAVE_PRESET, WC_GAME_OPTIONS, WDF_MODAL, - _nested_save_preset_widgets, lengthof(_nested_save_preset_widgets) + std::begin(_nested_save_preset_widgets), std::end(_nested_save_preset_widgets) ); /** Class for the save preset window. */ @@ -2189,7 +2189,7 @@ static WindowDesc _scan_progress_desc( WDP_CENTER, nullptr, 0, 0, WC_MODAL_PROGRESS, WC_NONE, 0, - _nested_scan_progress_widgets, lengthof(_nested_scan_progress_widgets) + std::begin(_nested_scan_progress_widgets), std::end(_nested_scan_progress_widgets) ); /** Window for showing the progress of NewGRF scanning. */ diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 765983c47a..a3cc39b778 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -100,7 +100,7 @@ static WindowDesc _normal_news_desc( WDP_MANUAL, nullptr, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, - _nested_normal_news_widgets, lengthof(_nested_normal_news_widgets) + std::begin(_nested_normal_news_widgets), std::end(_nested_normal_news_widgets) ); /* New vehicles news items. */ @@ -127,7 +127,7 @@ static WindowDesc _vehicle_news_desc( WDP_MANUAL, nullptr, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, - _nested_vehicle_news_widgets, lengthof(_nested_vehicle_news_widgets) + std::begin(_nested_vehicle_news_widgets), std::end(_nested_vehicle_news_widgets) ); /* Company news items. */ @@ -155,7 +155,7 @@ static WindowDesc _company_news_desc( WDP_MANUAL, nullptr, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, - _nested_company_news_widgets, lengthof(_nested_company_news_widgets) + std::begin(_nested_company_news_widgets), std::end(_nested_company_news_widgets) ); /* Thin news items. */ @@ -178,7 +178,7 @@ static WindowDesc _thin_news_desc( WDP_MANUAL, nullptr, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, - _nested_thin_news_widgets, lengthof(_nested_thin_news_widgets) + std::begin(_nested_thin_news_widgets), std::end(_nested_thin_news_widgets) ); /* Small news items. */ @@ -204,7 +204,7 @@ static WindowDesc _small_news_desc( WDP_MANUAL, nullptr, 0, 0, WC_NEWS_WINDOW, WC_NONE, 0, - _nested_small_news_widgets, lengthof(_nested_small_news_widgets) + std::begin(_nested_small_news_widgets), std::end(_nested_small_news_widgets) ); /** @@ -1231,7 +1231,7 @@ static WindowDesc _message_history_desc( WDP_AUTO, "list_news", 400, 140, WC_MESSAGE_HISTORY, WC_NONE, 0, - _nested_message_history, lengthof(_nested_message_history) + std::begin(_nested_message_history), std::end(_nested_message_history) ); /** Display window with news messages history */ diff --git a/src/object_gui.cpp b/src/object_gui.cpp index f18e1660f1..f7f6fb8de7 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -720,7 +720,7 @@ static WindowDesc _build_object_desc( WDP_AUTO, "build_object", 0, 0, WC_BUILD_OBJECT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_object_widgets, lengthof(_nested_build_object_widgets), + std::begin(_nested_build_object_widgets), std::end(_nested_build_object_widgets), &BuildObjectWindow::hotkeys ); diff --git a/src/order_gui.cpp b/src/order_gui.cpp index e3e84f21d5..61595f4391 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1640,7 +1640,7 @@ static WindowDesc _orders_train_desc( WDP_AUTO, "view_vehicle_orders_train", 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, - _nested_orders_train_widgets, lengthof(_nested_orders_train_widgets), + std::begin(_nested_orders_train_widgets), std::end(_nested_orders_train_widgets), &OrdersWindow::hotkeys ); @@ -1713,7 +1713,7 @@ static WindowDesc _orders_desc( WDP_AUTO, "view_vehicle_orders", 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, - _nested_orders_widgets, lengthof(_nested_orders_widgets), + std::begin(_nested_orders_widgets), std::end(_nested_orders_widgets), &OrdersWindow::hotkeys ); @@ -1740,7 +1740,7 @@ static WindowDesc _other_orders_desc( WDP_AUTO, "view_vehicle_orders_competitor", 384, 86, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, - _nested_other_orders_widgets, lengthof(_nested_other_orders_widgets), + std::begin(_nested_other_orders_widgets), std::end(_nested_other_orders_widgets), &OrdersWindow::hotkeys ); diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index c43d319b75..6c189e343f 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -338,7 +338,7 @@ static WindowDesc _osk_desc( WDP_CENTER, nullptr, 0, 0, WC_OSK, WC_NONE, 0, - _nested_osk_widgets, lengthof(_nested_osk_widgets) + std::begin(_nested_osk_widgets), std::end(_nested_osk_widgets) ); /** diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index e471cf6ec5..95c84b6d8d 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -841,7 +841,7 @@ static WindowDesc _build_rail_desc( WDP_ALIGN_TOOLBAR, "toolbar_rail", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_rail_widgets, lengthof(_nested_build_rail_widgets), + std::begin(_nested_build_rail_widgets), std::end(_nested_build_rail_widgets), &BuildRailToolbarWindow::hotkeys ); @@ -1631,7 +1631,7 @@ static WindowDesc _station_builder_desc( WDP_AUTO, "build_station_rail", 350, 0, WC_BUILD_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_station_builder_widgets, lengthof(_nested_station_builder_widgets), + std::begin(_nested_station_builder_widgets), std::end(_nested_station_builder_widgets), &BuildRailStationWindow::hotkeys ); @@ -1889,7 +1889,7 @@ static WindowDesc _signal_builder_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_SIGNAL, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_signal_builder_widgets, lengthof(_nested_signal_builder_widgets) + std::begin(_nested_signal_builder_widgets), std::end(_nested_signal_builder_widgets) ); /** @@ -1980,7 +1980,7 @@ static WindowDesc _build_depot_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_depot_widgets, lengthof(_nested_build_depot_widgets) + std::begin(_nested_build_depot_widgets), std::end(_nested_build_depot_widgets) ); static void ShowBuildTrainDepotPicker(Window *parent) @@ -2208,7 +2208,7 @@ static WindowDesc _build_waypoint_desc( WDP_AUTO, "build_waypoint", 0, 0, WC_BUILD_WAYPOINT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_waypoint_widgets, lengthof(_nested_build_waypoint_widgets) + std::begin(_nested_build_waypoint_widgets), std::end(_nested_build_waypoint_widgets) ); static void ShowBuildWaypointPicker(Window *parent) diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 056febcf00..5f5acde8d1 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -858,7 +858,7 @@ static WindowDesc _build_road_desc( WDP_ALIGN_TOOLBAR, "toolbar_road", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_road_widgets, lengthof(_nested_build_road_widgets), + std::begin(_nested_build_road_widgets), std::end(_nested_build_road_widgets), &BuildRoadToolbarWindow::road_hotkeys ); @@ -899,7 +899,7 @@ static WindowDesc _build_tramway_desc( WDP_ALIGN_TOOLBAR, "toolbar_tramway", 0, 0, WC_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_tramway_widgets, lengthof(_nested_build_tramway_widgets), + std::begin(_nested_build_tramway_widgets), std::end(_nested_build_tramway_widgets), &BuildRoadToolbarWindow::tram_hotkeys ); @@ -954,7 +954,7 @@ static WindowDesc _build_road_scen_desc( WDP_AUTO, "toolbar_road_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_road_scen_widgets, lengthof(_nested_build_road_scen_widgets), + std::begin(_nested_build_road_scen_widgets), std::end(_nested_build_road_scen_widgets), &BuildRoadToolbarWindow::road_hotkeys ); @@ -989,7 +989,7 @@ static WindowDesc _build_tramway_scen_desc( WDP_AUTO, "toolbar_tram_scen", 0, 0, WC_SCEN_BUILD_TOOLBAR, WC_NONE, WDF_CONSTRUCTION, - _nested_build_tramway_scen_widgets, lengthof(_nested_build_tramway_scen_widgets), + std::begin(_nested_build_tramway_scen_widgets), std::end(_nested_build_tramway_scen_widgets), &BuildRoadToolbarWindow::tram_hotkeys ); @@ -1087,7 +1087,7 @@ static WindowDesc _build_road_depot_desc( WDP_AUTO, nullptr, 0, 0, WC_BUILD_DEPOT, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_build_road_depot_widgets, lengthof(_nested_build_road_depot_widgets) + std::begin(_nested_build_road_depot_widgets), std::end(_nested_build_road_depot_widgets) ); static void ShowRoadDepotPicker(Window *parent) @@ -1684,7 +1684,7 @@ static WindowDesc _road_station_picker_desc( WDP_AUTO, "build_station_road", 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_road_station_picker_widgets, lengthof(_nested_road_station_picker_widgets) + std::begin(_nested_road_station_picker_widgets), std::end(_nested_road_station_picker_widgets) ); /** Widget definition of the build tram station window */ @@ -1769,7 +1769,7 @@ static WindowDesc _tram_station_picker_desc( WDP_AUTO, "build_station_tram", 0, 0, WC_BUS_STATION, WC_BUILD_TOOLBAR, WDF_CONSTRUCTION, - _nested_tram_station_picker_widgets, lengthof(_nested_tram_station_picker_widgets) + std::begin(_nested_tram_station_picker_widgets), std::end(_nested_tram_station_picker_widgets) ); static void ShowRVStationPicker(Window *parent, RoadStopType rs) diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index b6d68d0919..2ace881092 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -65,7 +65,7 @@ static WindowDesc _screenshot_window_desc( WDP_AUTO, "take_a_screenshot", 200, 100, WC_SCREENSHOT, WC_NONE, 0, - _nested_screenshot, lengthof(_nested_screenshot) + std::begin(_nested_screenshot), std::end(_nested_screenshot) ); void ShowScreenshotWindow() diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index cb9c01b01f..90be17a5d5 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -265,7 +265,7 @@ static WindowDesc _script_list_desc( WDP_CENTER, "settings_script_list", 200, 234, WC_SCRIPT_LIST, WC_NONE, 0, - _nested_script_list_widgets, lengthof(_nested_script_list_widgets) + std::begin(_nested_script_list_widgets), std::end(_nested_script_list_widgets) ); /** @@ -608,7 +608,7 @@ static WindowDesc _script_settings_desc( WDP_CENTER, "settings_script", 500, 208, WC_SCRIPT_SETTINGS, WC_NONE, 0, - _nested_script_settings_widgets, lengthof(_nested_script_settings_widgets) + std::begin(_nested_script_settings_widgets), std::end(_nested_script_settings_widgets) ); /** @@ -1195,7 +1195,7 @@ static WindowDesc _script_debug_desc( WDP_AUTO, "script_debug", 600, 450, WC_SCRIPT_DEBUG, WC_NONE, 0, - _nested_script_debug_widgets, lengthof(_nested_script_debug_widgets), + std::begin(_nested_script_debug_widgets), std::end(_nested_script_debug_widgets), &ScriptDebugWindow::hotkeys ); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 2f1fedf05d..140b3765e7 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -925,7 +925,7 @@ static WindowDesc _game_options_desc( WDP_CENTER, nullptr, 0, 0, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_game_options_widgets, lengthof(_nested_game_options_widgets) + std::begin(_nested_game_options_widgets), std::end(_nested_game_options_widgets) ); /** Open the game options window. */ @@ -2657,7 +2657,7 @@ static WindowDesc _settings_selection_desc( WDP_CENTER, "settings", 510, 450, WC_GAME_OPTIONS, WC_NONE, 0, - _nested_settings_selection_widgets, lengthof(_nested_settings_selection_widgets) + std::begin(_nested_settings_selection_widgets), std::end(_nested_settings_selection_widgets) ); /** Open advanced settings window. */ @@ -2956,7 +2956,7 @@ static WindowDesc _cust_currency_desc( WDP_CENTER, nullptr, 0, 0, WC_CUSTOM_CURRENCY, WC_NONE, 0, - _nested_cust_currency_widgets, lengthof(_nested_cust_currency_widgets) + std::begin(_nested_cust_currency_widgets), std::end(_nested_cust_currency_widgets) ); /** Open custom currency window. */ diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index 94a2d2fc9a..e3c9cd84ea 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -389,7 +389,7 @@ static WindowDesc _sign_list_desc( WDP_AUTO, "list_signs", 358, 138, WC_SIGN_LIST, WC_NONE, 0, - _nested_sign_list_widgets, lengthof(_nested_sign_list_widgets), + std::begin(_nested_sign_list_widgets), std::end(_nested_sign_list_widgets), &SignListWindow::hotkeys ); @@ -555,7 +555,7 @@ static WindowDesc _query_sign_edit_desc( WDP_CENTER, nullptr, 0, 0, WC_QUERY_STRING, WC_NONE, WDF_CONSTRUCTION, - _nested_query_sign_edit_widgets, lengthof(_nested_query_sign_edit_widgets) + std::begin(_nested_query_sign_edit_widgets), std::end(_nested_query_sign_edit_widgets) ); /** diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index c928f08b52..4e17c1f55d 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1833,8 +1833,8 @@ static NWidgetBase *SmallMapDisplay(int *biggest_index) { NWidgetContainer *map_display = new NWidgetSmallmapDisplay; - MakeNWidgets(_nested_smallmap_display, lengthof(_nested_smallmap_display), biggest_index, map_display); - MakeNWidgets(_nested_smallmap_bar, lengthof(_nested_smallmap_bar), biggest_index, map_display); + MakeNWidgets(std::begin(_nested_smallmap_display), std::end(_nested_smallmap_display), biggest_index, map_display); + MakeNWidgets(std::begin(_nested_smallmap_bar), std::end(_nested_smallmap_bar), biggest_index, map_display); return map_display; } @@ -1869,7 +1869,7 @@ static WindowDesc _smallmap_desc( WDP_AUTO, "smallmap", 484, 314, WC_SMALLMAP, WC_NONE, 0, - _nested_smallmap_widgets, lengthof(_nested_smallmap_widgets) + std::begin(_nested_smallmap_widgets), std::end(_nested_smallmap_widgets) ); /** diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 941d309494..fcff2b1e25 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -765,7 +765,7 @@ static WindowDesc _company_stations_desc( WDP_AUTO, "list_stations", 358, 162, WC_STATION_LIST, WC_NONE, 0, - _nested_company_stations_widgets, lengthof(_nested_company_stations_widgets) + std::begin(_nested_company_stations_widgets), std::end(_nested_company_stations_widgets) ); /** @@ -2121,7 +2121,7 @@ static WindowDesc _station_view_desc( WDP_AUTO, "view_station", 249, 117, WC_STATION_VIEW, WC_NONE, 0, - _nested_station_view_widgets, lengthof(_nested_station_view_widgets) + std::begin(_nested_station_view_widgets), std::end(_nested_station_view_widgets) ); /** @@ -2378,7 +2378,7 @@ static WindowDesc _select_station_desc( WDP_AUTO, "build_station_join", 200, 180, WC_SELECT_STATION, WC_NONE, WDF_CONSTRUCTION, - _nested_select_station_widgets, lengthof(_nested_select_station_widgets) + std::begin(_nested_select_station_widgets), std::end(_nested_select_station_widgets) ); diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 848b7ee6b0..be49e19854 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -231,7 +231,7 @@ static WindowDesc _main_status_desc( WDP_MANUAL, nullptr, 0, 0, WC_STATUS_BAR, WC_NONE, WDF_NO_FOCUS | WDF_NO_CLOSE, - _nested_main_status_widgets, lengthof(_nested_main_status_widgets) + std::begin(_nested_main_status_widgets), std::end(_nested_main_status_widgets) ); /** diff --git a/src/story_gui.cpp b/src/story_gui.cpp index 3ed03149c7..9f3db43d1b 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -972,7 +972,7 @@ static WindowDesc _story_book_desc( WDP_CENTER, "view_story", 400, 300, WC_STORY_BOOK, WC_NONE, 0, - _nested_story_book_widgets, lengthof(_nested_story_book_widgets) + std::begin(_nested_story_book_widgets), std::end(_nested_story_book_widgets) ); static CursorID TranslateStoryPageButtonCursor(StoryPageButtonCursor cursor) diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index d19c6e750d..ff6efbc651 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -238,7 +238,7 @@ static WindowDesc _subsidies_list_desc( WDP_AUTO, "list_subsidies", 500, 127, WC_SUBSIDIES_LIST, WC_NONE, 0, - _nested_subsidies_list_widgets, lengthof(_nested_subsidies_list_widgets) + std::begin(_nested_subsidies_list_widgets), std::end(_nested_subsidies_list_widgets) ); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index ee7a353e58..d24cbcc5d4 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -355,7 +355,7 @@ static WindowDesc _terraform_desc( WDP_MANUAL, "toolbar_landscape", 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, - _nested_terraform_widgets, lengthof(_nested_terraform_widgets), + std::begin(_nested_terraform_widgets), std::end(_nested_terraform_widgets), &TerraformToolbarWindow::hotkeys ); @@ -743,7 +743,7 @@ static WindowDesc _scen_edit_land_gen_desc( WDP_AUTO, "toolbar_landscape_scen", 0, 0, WC_SCEN_LAND_GEN, WC_NONE, WDF_CONSTRUCTION, - _nested_scen_edit_land_gen_widgets, lengthof(_nested_scen_edit_land_gen_widgets), + std::begin(_nested_scen_edit_land_gen_widgets), std::end(_nested_scen_edit_land_gen_widgets), &ScenarioEditorLandscapeGenerationWindow::hotkeys ); diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 210cdb3070..37bf6653f2 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -56,7 +56,7 @@ static WindowDesc _textfile_desc( WDP_CENTER, "textfile", 630, 460, WC_TEXTFILE, WC_NONE, 0, - _nested_textfile_widgets, lengthof(_nested_textfile_widgets) + std::begin(_nested_textfile_widgets), std::end(_nested_textfile_widgets) ); TextfileWindow::TextfileWindow(TextfileType file_type) : Window(&_textfile_desc), file_type(file_type) diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 80b49a24f0..e58375d64d 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -746,7 +746,7 @@ static WindowDesc _timetable_desc( WDP_AUTO, "view_vehicle_timetable", 400, 130, WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, - _nested_timetable_widgets, lengthof(_nested_timetable_widgets) + std::begin(_nested_timetable_widgets), std::end(_nested_timetable_widgets) ); /** diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index f7f7eccdc1..91c2def043 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2254,7 +2254,7 @@ static WindowDesc _toolb_normal_desc( WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS | WDF_NO_CLOSE, - _nested_toolbar_normal_widgets, lengthof(_nested_toolbar_normal_widgets), + std::begin(_nested_toolbar_normal_widgets), std::end(_nested_toolbar_normal_widgets), &MainToolbarWindow::hotkeys ); @@ -2583,7 +2583,7 @@ static const NWidgetPart _nested_toolb_scen_inner_widgets[] = { static NWidgetBase *MakeScenarioToolbar(int *biggest_index) { - return MakeNWidgets(_nested_toolb_scen_inner_widgets, lengthof(_nested_toolb_scen_inner_widgets), biggest_index, new NWidgetScenarioToolbarContainer()); + return MakeNWidgets(std::begin(_nested_toolb_scen_inner_widgets), std::end(_nested_toolb_scen_inner_widgets), biggest_index, new NWidgetScenarioToolbarContainer()); } static const NWidgetPart _nested_toolb_scen_widgets[] = { @@ -2594,7 +2594,7 @@ static WindowDesc _toolb_scen_desc( WDP_MANUAL, nullptr, 0, 0, WC_MAIN_TOOLBAR, WC_NONE, WDF_NO_FOCUS | WDF_NO_CLOSE, - _nested_toolb_scen_widgets, lengthof(_nested_toolb_scen_widgets), + std::begin(_nested_toolb_scen_widgets), std::end(_nested_toolb_scen_widgets), &ScenarioEditorToolbarWindow::hotkeys ); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 15c1be5b27..8b2a820f57 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -330,7 +330,7 @@ static WindowDesc _town_authority_desc( WDP_AUTO, "view_town_authority", 317, 222, WC_TOWN_AUTHORITY, WC_NONE, 0, - _nested_town_authority_widgets, lengthof(_nested_town_authority_widgets) + std::begin(_nested_town_authority_widgets), std::end(_nested_town_authority_widgets) ); static void ShowTownAuthorityWindow(uint town) @@ -631,7 +631,7 @@ static WindowDesc _town_game_view_desc( WDP_AUTO, "view_town", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, 0, - _nested_town_game_view_widgets, lengthof(_nested_town_game_view_widgets) + std::begin(_nested_town_game_view_widgets), std::end(_nested_town_game_view_widgets) ); static const NWidgetPart _nested_town_editor_view_widgets[] = { @@ -662,7 +662,7 @@ static WindowDesc _town_editor_view_desc( WDP_AUTO, "view_town_scen", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, 0, - _nested_town_editor_view_widgets, lengthof(_nested_town_editor_view_widgets) + std::begin(_nested_town_editor_view_widgets), std::end(_nested_town_editor_view_widgets) ); void ShowTownViewWindow(TownID town) @@ -1037,7 +1037,7 @@ static WindowDesc _town_directory_desc( WDP_AUTO, "list_towns", 208, 202, WC_TOWN_DIRECTORY, WC_NONE, 0, - _nested_town_directory_widgets, lengthof(_nested_town_directory_widgets) + std::begin(_nested_town_directory_widgets), std::end(_nested_town_directory_widgets) ); void ShowTownDirectory() @@ -1287,7 +1287,7 @@ static WindowDesc _found_town_desc( WDP_AUTO, "build_town", 160, 162, WC_FOUND_TOWN, WC_NONE, WDF_CONSTRUCTION, - _nested_found_town_widgets, lengthof(_nested_found_town_widgets) + std::begin(_nested_found_town_widgets), std::end(_nested_found_town_widgets) ); void ShowFoundTownWindow() diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 8c11803f07..6d998de96b 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -152,7 +152,7 @@ static WindowDesc _transparency_desc( WDP_MANUAL, "toolbar_transparency", 0, 0, WC_TRANSPARENCY_TOOLBAR, WC_NONE, 0, - _nested_transparency_widgets, lengthof(_nested_transparency_widgets) + std::begin(_nested_transparency_widgets), std::end(_nested_transparency_widgets) ); /** diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index ac8d0fc962..fb39ab7fd7 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -320,7 +320,7 @@ static WindowDesc _build_trees_desc( WDP_AUTO, "build_tree", 0, 0, WC_BUILD_TREES, WC_NONE, WDF_CONSTRUCTION, - _nested_build_trees_widgets, lengthof(_nested_build_trees_widgets) + std::begin(_nested_build_trees_widgets), std::end(_nested_build_trees_widgets) ); void ShowBuildTreesToolbar() diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 9810c9c17f..71250a5d1e 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1238,7 +1238,7 @@ static WindowDesc _vehicle_refit_desc( WDP_AUTO, "view_vehicle_refit", 240, 174, WC_VEHICLE_REFIT, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, - _nested_vehicle_refit_widgets, lengthof(_nested_vehicle_refit_widgets) + std::begin(_nested_vehicle_refit_widgets), std::end(_nested_vehicle_refit_widgets) ); /** @@ -2171,14 +2171,14 @@ static WindowDesc _vehicle_list_other_desc( WDP_AUTO, "list_vehicles", 260, 246, WC_INVALID, WC_NONE, 0, - _nested_vehicle_list, lengthof(_nested_vehicle_list) + std::begin(_nested_vehicle_list), std::end(_nested_vehicle_list) ); static WindowDesc _vehicle_list_train_desc( WDP_AUTO, "list_vehicles_train", 325, 246, WC_TRAINS_LIST, WC_NONE, 0, - _nested_vehicle_list, lengthof(_nested_vehicle_list) + std::begin(_nested_vehicle_list), std::end(_nested_vehicle_list) ); static void ShowVehicleListWindowLocal(CompanyID company, VehicleListType vlt, VehicleType vehicle_type, uint32_t unique_number) @@ -2680,7 +2680,7 @@ static WindowDesc _train_vehicle_details_desc( WDP_AUTO, "view_vehicle_details_train", 405, 178, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, 0, - _nested_train_vehicle_details_widgets, lengthof(_nested_train_vehicle_details_widgets) + std::begin(_nested_train_vehicle_details_widgets), std::end(_nested_train_vehicle_details_widgets) ); /** Vehicle details window descriptor for other vehicles than a train. */ @@ -2688,7 +2688,7 @@ static WindowDesc _nontrain_vehicle_details_desc( WDP_AUTO, "view_vehicle_details", 405, 113, WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, 0, - _nested_nontrain_vehicle_details_widgets, lengthof(_nested_nontrain_vehicle_details_widgets) + std::begin(_nested_nontrain_vehicle_details_widgets), std::end(_nested_nontrain_vehicle_details_widgets) ); /** Shows the vehicle details window of the given vehicle. */ @@ -3285,7 +3285,7 @@ static WindowDesc _vehicle_view_desc( WDP_AUTO, "view_vehicle", 250, 116, WC_VEHICLE_VIEW, WC_NONE, 0, - _nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets), + std::begin(_nested_vehicle_view_widgets), std::end(_nested_vehicle_view_widgets), &VehicleViewWindow::hotkeys ); @@ -3297,7 +3297,7 @@ static WindowDesc _train_view_desc( WDP_AUTO, "view_vehicle_train", 250, 134, WC_VEHICLE_VIEW, WC_NONE, 0, - _nested_vehicle_view_widgets, lengthof(_nested_vehicle_view_widgets), + std::begin(_nested_vehicle_view_widgets), std::end(_nested_vehicle_view_widgets), &VehicleViewWindow::hotkeys ); diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index c8bf96157b..c81e4920f6 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -163,7 +163,7 @@ static WindowDesc _extra_viewport_desc( WDP_AUTO, "extra_viewport", 300, 268, WC_EXTRA_VIEWPORT, WC_NONE, 0, - _nested_extra_viewport_widgets, lengthof(_nested_extra_viewport_widgets) + std::begin(_nested_extra_viewport_widgets), std::end(_nested_extra_viewport_widgets) ); /** diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index d8b3c10379..d2042cf90e 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -187,7 +187,7 @@ static WindowDesc _waypoint_view_desc( WDP_AUTO, "view_waypoint", 260, 118, WC_WAYPOINT_VIEW, WC_NONE, 0, - _nested_waypoint_view_widgets, lengthof(_nested_waypoint_view_widgets) + std::begin(_nested_waypoint_view_widgets), std::end(_nested_waypoint_view_widgets) ); /** diff --git a/src/widget.cpp b/src/widget.cpp index 5d2687f97a..9eabaa8a3c 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -3008,23 +3008,23 @@ bool NWidgetLeaf::ButtonHit(const Point &pt) * settings that follow it, until encountering a #EndContainer, another * #NWidget, or the end of the parts array. * - * @param parts Array with parts of the nested widget. - * @param count Length of the \a parts array. + * @param nwid_begin Pointer to beginning of nested widget parts. + * @param nwid_end Pointer to ending of nested widget parts. * @param dest Address of pointer to use for returning the composed widget. * @param fill_dest Fill the composed widget with child widgets. * @param biggest_index Pointer to biggest nested widget index in the tree encountered so far. * @return Number of widget part elements used to compose the widget. * @pre \c biggest_index != nullptr. */ -static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, bool *fill_dest, int *biggest_index) +static int MakeNWidget(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, NWidgetBase **dest, bool *fill_dest, int *biggest_index) { int num_used = 0; *dest = nullptr; *fill_dest = false; - while (count > num_used) { - switch (parts->type) { + while (nwid_begin < nwid_end) { + switch (nwid_begin->type) { case NWID_SPACER: if (*dest != nullptr) return num_used; *dest = new NWidgetSpacer(0, 0); @@ -3032,13 +3032,13 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case NWID_HORIZONTAL: if (*dest != nullptr) return num_used; - *dest = new NWidgetHorizontal(parts->u.cont_flags); + *dest = new NWidgetHorizontal(nwid_begin->u.cont_flags); *fill_dest = true; break; case NWID_HORIZONTAL_LTR: if (*dest != nullptr) return num_used; - *dest = new NWidgetHorizontalLTR(parts->u.cont_flags); + *dest = new NWidgetHorizontalLTR(nwid_begin->u.cont_flags); *fill_dest = true; break; @@ -3046,14 +3046,14 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WWT_INSET: case WWT_FRAME: if (*dest != nullptr) return num_used; - *dest = new NWidgetBackground(parts->type, parts->u.widget.colour, parts->u.widget.index); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + *dest = new NWidgetBackground(nwid_begin->type, nwid_begin->u.widget.colour, nwid_begin->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); *fill_dest = true; break; case NWID_VERTICAL: if (*dest != nullptr) return num_used; - *dest = new NWidgetVertical(parts->u.cont_flags); + *dest = new NWidgetVertical(nwid_begin->u.cont_flags); *fill_dest = true; break; @@ -3062,9 +3062,9 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, NWidgetMatrix *nwm = new NWidgetMatrix(); *dest = nwm; *fill_dest = true; - nwm->SetIndex(parts->u.widget.index); - nwm->SetColour(parts->u.widget.colour); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + nwm->SetIndex(nwid_begin->u.widget.index); + nwm->SetColour(nwid_begin->u.widget.colour); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); break; } @@ -3072,7 +3072,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, if (*dest != nullptr) return num_used; /* Ensure proper functioning even when the called code simply writes its largest index. */ int biggest = -1; - *dest = parts->u.func_ptr(&biggest); + *dest = nwid_begin->u.func_ptr(&biggest); *biggest_index = std::max(*biggest_index, biggest); *fill_dest = false; break; @@ -3081,8 +3081,8 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WPT_RESIZE: { NWidgetResizeBase *nwrb = dynamic_cast(*dest); if (nwrb != nullptr) { - assert(parts->u.xy.x >= 0 && parts->u.xy.y >= 0); - nwrb->SetResize(parts->u.xy.x, parts->u.xy.y); + assert(nwid_begin->u.xy.x >= 0 && nwid_begin->u.xy.y >= 0); + nwrb->SetResize(nwid_begin->u.xy.x, nwid_begin->u.xy.y); } break; } @@ -3090,8 +3090,8 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WPT_MINSIZE: { NWidgetResizeBase *nwrb = dynamic_cast(*dest); if (nwrb != nullptr) { - assert(parts->u.xy.x >= 0 && parts->u.xy.y >= 0); - nwrb->SetMinimalSize(parts->u.xy.x, parts->u.xy.y); + assert(nwid_begin->u.xy.x >= 0 && nwid_begin->u.xy.y >= 0); + nwrb->SetMinimalSize(nwid_begin->u.xy.x, nwid_begin->u.xy.y); } break; } @@ -3099,8 +3099,8 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WPT_MINTEXTLINES: { NWidgetResizeBase *nwrb = dynamic_cast(*dest); if (nwrb != nullptr) { - assert(parts->u.text_lines.size >= FS_BEGIN && parts->u.text_lines.size < FS_END); - nwrb->SetMinimalTextLines(parts->u.text_lines.lines, parts->u.text_lines.spacing, parts->u.text_lines.size); + assert(nwid_begin->u.text_lines.size >= FS_BEGIN && nwid_begin->u.text_lines.size < FS_END); + nwrb->SetMinimalTextLines(nwid_begin->u.text_lines.lines, nwid_begin->u.text_lines.spacing, nwid_begin->u.text_lines.size); } break; } @@ -3108,7 +3108,7 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WPT_TEXTSTYLE: { NWidgetCore *nwc = dynamic_cast(*dest); if (nwc != nullptr) { - nwc->SetTextStyle(parts->u.text_style.colour, parts->u.text_style.size); + nwc->SetTextStyle(nwid_begin->u.text_style.colour, nwid_begin->u.text_style.size); } break; } @@ -3116,43 +3116,43 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case WPT_ALIGNMENT: { NWidgetCore *nwc = dynamic_cast(*dest); if (nwc != nullptr) { - nwc->SetAlignment(parts->u.align.align); + nwc->SetAlignment(nwid_begin->u.align.align); } break; } case WPT_FILL: { NWidgetResizeBase *nwrb = dynamic_cast(*dest); - if (nwrb != nullptr) nwrb->SetFill(parts->u.xy.x, parts->u.xy.y); + if (nwrb != nullptr) nwrb->SetFill(nwid_begin->u.xy.x, nwid_begin->u.xy.y); break; } case WPT_DATATIP: { NWidgetCore *nwc = dynamic_cast(*dest); if (nwc != nullptr) { - nwc->widget_data = parts->u.data_tip.data; - nwc->tool_tip = parts->u.data_tip.tooltip; + nwc->widget_data = nwid_begin->u.data_tip.data; + nwc->tool_tip = nwid_begin->u.data_tip.tooltip; } break; } case WPT_PADDING: - if (*dest != nullptr) (*dest)->SetPadding(parts->u.padding); + if (*dest != nullptr) (*dest)->SetPadding(nwid_begin->u.padding); break; case WPT_PIPSPACE: { NWidgetPIPContainer *nwc = dynamic_cast(*dest); - if (nwc != nullptr) nwc->SetPIP(parts->u.pip.pre, parts->u.pip.inter, parts->u.pip.post); + if (nwc != nullptr) nwc->SetPIP(nwid_begin->u.pip.pre, nwid_begin->u.pip.inter, nwid_begin->u.pip.post); NWidgetBackground *nwb = dynamic_cast(*dest); - if (nwb != nullptr) nwb->SetPIP(parts->u.pip.pre, parts->u.pip.inter, parts->u.pip.post); + if (nwb != nullptr) nwb->SetPIP(nwid_begin->u.pip.pre, nwid_begin->u.pip.inter, nwid_begin->u.pip.post); break; } case WPT_SCROLLBAR: { NWidgetCore *nwc = dynamic_cast(*dest); if (nwc != nullptr) { - nwc->scrollbar_index = parts->u.widget.index; + nwc->scrollbar_index = nwid_begin->u.widget.index; } break; } @@ -3162,15 +3162,15 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, case NWID_VIEWPORT: if (*dest != nullptr) return num_used; - *dest = new NWidgetViewport(parts->u.widget.index); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + *dest = new NWidgetViewport(nwid_begin->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); break; case NWID_HSCROLLBAR: case NWID_VSCROLLBAR: if (*dest != nullptr) return num_used; - *dest = new NWidgetScrollbar(parts->type, parts->u.widget.colour, parts->u.widget.index); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + *dest = new NWidgetScrollbar(nwid_begin->type, nwid_begin->u.widget.colour, nwid_begin->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); break; case NWID_SELECTION: { @@ -3178,20 +3178,20 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, NWidgetStacked *nws = new NWidgetStacked(); *dest = nws; *fill_dest = true; - nws->SetIndex(parts->u.widget.index); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + nws->SetIndex(nwid_begin->u.widget.index); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); break; } default: if (*dest != nullptr) return num_used; - assert((parts->type & WWT_MASK) < WWT_LAST || (parts->type & WWT_MASK) == NWID_BUTTON_DROPDOWN); - *dest = new NWidgetLeaf(parts->type, parts->u.widget.colour, parts->u.widget.index, 0x0, STR_NULL); - *biggest_index = std::max(*biggest_index, (int)parts->u.widget.index); + assert((nwid_begin->type & WWT_MASK) < WWT_LAST || (nwid_begin->type & WWT_MASK) == NWID_BUTTON_DROPDOWN); + *dest = new NWidgetLeaf(nwid_begin->type, nwid_begin->u.widget.colour, nwid_begin->u.widget.index, 0x0, STR_NULL); + *biggest_index = std::max(*biggest_index, (int)nwid_begin->u.widget.index); break; } num_used++; - parts++; + nwid_begin++; } return num_used; @@ -3199,14 +3199,14 @@ static int MakeNWidget(const NWidgetPart *parts, int count, NWidgetBase **dest, /** * Build a nested widget tree by recursively filling containers with nested widgets read from their parts. - * @param parts Array with parts of the nested widgets. - * @param count Length of the \a parts array. + * @param nwid_begin Pointer to beginning of nested widget parts. + * @param nwid_end Pointer to ending of nested widget parts. * @param parent Pointer or container to use for storing the child widgets (*parent == nullptr or *parent == container or background widget). * @param biggest_index Pointer to biggest nested widget index in the tree. * @return Number of widget part elements used to fill the container. * @post \c *biggest_index contains the largest widget index of the tree and \c -1 if no index is used. */ -static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **parent, int *biggest_index) +static int MakeWidgetTree(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, NWidgetBase **parent, int *biggest_index) { /* If *parent == nullptr, only the first widget is read and returned. Otherwise, *parent must point to either * a #NWidgetContainer or a #NWidgetBackground object, and parts are added as much as possible. */ @@ -3218,8 +3218,8 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par for (;;) { NWidgetBase *sub_widget = nullptr; bool fill_sub = false; - int num_used = MakeNWidget(parts, count - total_used, &sub_widget, &fill_sub, biggest_index); - parts += num_used; + int num_used = MakeNWidget(nwid_begin, nwid_end, &sub_widget, &fill_sub, biggest_index); + nwid_begin += num_used; total_used += num_used; /* Break out of loop when end reached */ @@ -3230,8 +3230,8 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par if (fill_sub && (tp == NWID_HORIZONTAL || tp == NWID_HORIZONTAL_LTR || tp == NWID_VERTICAL || tp == NWID_MATRIX || tp == WWT_PANEL || tp == WWT_FRAME || tp == WWT_INSET || tp == NWID_SELECTION)) { NWidgetBase *sub_ptr = sub_widget; - num_used = MakeWidgetTree(parts, count - total_used, &sub_ptr, biggest_index); - parts += num_used; + num_used = MakeWidgetTree(nwid_begin, nwid_end, &sub_ptr, biggest_index); + nwid_begin += num_used; total_used += num_used; } @@ -3244,17 +3244,17 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par } } - if (count == total_used) return total_used; // Reached the end of the array of parts? + if (nwid_begin == nwid_end) return total_used; // Reached the end of the array of parts? - assert(total_used < count); - assert(parts->type == WPT_ENDCONTAINER); - return total_used + 1; // *parts is also 'used' + assert(nwid_begin < nwid_end); + assert(nwid_begin->type == WPT_ENDCONTAINER); + return total_used + 1; // *nwid_begin is also 'used' } /** * Construct a nested widget tree from an array of parts. - * @param parts Array with parts of the widgets. - * @param count Length of the \a parts array. + * @param nwid_begin Pointer to beginning of nested widget parts. + * @param nwid_end Pointer to ending of nested widget parts. * @param biggest_index Pointer to biggest nested widget index collected in the tree. * @param container Container to add the nested widgets to. In case it is nullptr a vertical container is used. * @return Root of the nested widget tree, a vertical container containing the entire GUI. @@ -3262,12 +3262,12 @@ static int MakeWidgetTree(const NWidgetPart *parts, int count, NWidgetBase **par * @pre \c biggest_index != nullptr * @post \c *biggest_index contains the largest widget index of the tree and \c -1 if no index is used. */ -NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container) +NWidgetContainer *MakeNWidgets(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetContainer *container) { *biggest_index = -1; if (container == nullptr) container = new NWidgetVertical(); NWidgetBase *cont_ptr = container; - MakeWidgetTree(parts, count, &cont_ptr, biggest_index); + MakeWidgetTree(nwid_begin, nwid_end, &cont_ptr, biggest_index); return container; } @@ -3275,8 +3275,8 @@ NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest * Make a nested widget tree for a window from a parts array. Besides loading, it inserts a shading selection widget * between the title bar and the window body if the first widget in the parts array looks like a title bar (it is a horizontal * container with a caption widget) and has a shade box widget. - * @param parts Array with parts of the widgets. - * @param count Length of the \a parts array. + * @param nwid_begin Pointer to beginning of nested widget parts. + * @param nwid_end Pointer to ending of nested widget parts. * @param biggest_index Pointer to biggest nested widget index collected in the tree. * @param[out] shade_select Pointer to the inserted shade selection widget (\c nullptr if not unserted). * @return Root of the nested widget tree, a vertical container containing the entire GUI. @@ -3284,20 +3284,19 @@ NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest * @pre \c biggest_index != nullptr * @post \c *biggest_index contains the largest widget index of the tree and \c -1 if no index is used. */ -NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select) +NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetStacked **shade_select) { *biggest_index = -1; /* Read the first widget recursively from the array. */ NWidgetBase *nwid = nullptr; - int num_used = MakeWidgetTree(parts, count, &nwid, biggest_index); + int num_used = MakeWidgetTree(nwid_begin, nwid_end, &nwid, biggest_index); assert(nwid != nullptr); - parts += num_used; - count -= num_used; + nwid_begin += num_used; NWidgetContainer *root = new NWidgetVertical; root->Add(nwid); - if (count == 0) { // There is no body at all. + if (nwid_begin == nwid_end) { // There is no body at all. *shade_select = nullptr; return root; } @@ -3318,7 +3317,7 @@ NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int /* Load the remaining parts into 'body'. */ int biggest2 = -1; - MakeNWidgets(parts, count, &biggest2, body); + MakeNWidgets(nwid_begin, nwid_end, &biggest2, body); *biggest_index = std::max(*biggest_index, biggest2); return root; diff --git a/src/widget_type.h b/src/widget_type.h index 6edbdf0533..f00577e9c4 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -1296,8 +1296,8 @@ static inline NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr) return part; } -NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest_index, NWidgetContainer *container); -NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *parts, int count, int *biggest_index, NWidgetStacked **shade_select); +NWidgetContainer *MakeNWidgets(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetContainer *container); +NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetStacked **shade_select); NWidgetBase *MakeCompanyButtonRows(int *biggest_index, int widget_first, int widget_last, Colours button_colour, int max_length, StringID button_tooltip); diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index d43e3f995f..137c375dcb 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -104,7 +104,7 @@ static WindowDesc _dropdown_desc( WDP_MANUAL, nullptr, 0, 0, WC_DROPDOWN_MENU, WC_NONE, WDF_NO_FOCUS, - _nested_dropdown_menu_widgets, lengthof(_nested_dropdown_menu_widgets) + std::begin(_nested_dropdown_menu_widgets), std::end(_nested_dropdown_menu_widgets) ); /** Drop-down menu window */ diff --git a/src/window.cpp b/src/window.cpp index ba8a06a1c8..839ccbb469 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -104,14 +104,14 @@ std::string _windows_file; /** Window description constructor. */ WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad, WindowClass window_class, WindowClass parent_class, uint32_t flags, - const NWidgetPart *nwid_parts, int16_t nwid_length, HotkeyList *hotkeys) : + const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, HotkeyList *hotkeys) : default_pos(def_pos), cls(window_class), parent_cls(parent_class), ini_key(ini_key), flags(flags), - nwid_parts(nwid_parts), - nwid_length(nwid_length), + nwid_begin(nwid_begin), + nwid_end(nwid_end), hotkeys(hotkeys), pref_sticky(false), pref_width(0), @@ -1798,7 +1798,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16_t sm_width, i void Window::CreateNestedTree(bool fill_nested) { int biggest_index = -1; - this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_parts, this->window_desc->nwid_length, &biggest_index, &this->shade_select); + this->nested_root = MakeWindowNWidgetTree(this->window_desc->nwid_begin, this->window_desc->nwid_end, &biggest_index, &this->shade_select); this->nested_array_size = (uint)(biggest_index + 1); if (fill_nested) { diff --git a/src/window_gui.h b/src/window_gui.h index 1d0d884c54..77f6d20429 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -97,7 +97,7 @@ struct WindowDesc : ZeroedMemoryAllocator { WindowDesc(WindowPosition default_pos, const char *ini_key, int16_t def_width_trad, int16_t def_height_trad, WindowClass window_class, WindowClass parent_class, uint32_t flags, - const NWidgetPart *nwid_parts, int16_t nwid_length, HotkeyList *hotkeys = nullptr); + const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, HotkeyList *hotkeys = nullptr); ~WindowDesc(); @@ -106,8 +106,8 @@ struct WindowDesc : ZeroedMemoryAllocator { WindowClass parent_cls; ///< Class of the parent window. @see WindowClass const char *ini_key; ///< Key to store window defaults in openttd.cfg. \c nullptr if nothing shall be stored. uint32_t flags; ///< Flags. @see WindowDefaultFlag - const NWidgetPart *nwid_parts; ///< Nested widget parts describing the window. - int16_t nwid_length; ///< Length of the #nwid_parts array. + const NWidgetPart *nwid_begin; ///< Beginning of nested widget parts describing the window. + const NWidgetPart *nwid_end; ///< Ending of nested widget parts describing the window. HotkeyList *hotkeys; ///< Hotkeys for the window. bool pref_sticky; ///< Preferred stickyness.