From 8ab0936491ff8dac0e1775ff7d2a98e475e41f57 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 16 Sep 2023 21:56:09 +0200 Subject: [PATCH 01/59] Codechange: use parameter pack/folding instead of va_arg macros for widget states --- src/airport_gui.cpp | 4 +--- src/build_vehicle_gui.cpp | 2 +- src/company_gui.cpp | 26 ++++++++++++------------- src/depot_gui.cpp | 3 +-- src/dock_gui.cpp | 3 +-- src/genworld_gui.cpp | 4 ++-- src/group_gui.cpp | 9 +++------ src/music_gui.cpp | 3 +-- src/newgrf_gui.cpp | 6 ++---- src/road_gui.cpp | 3 +-- src/script/script_gui.cpp | 2 +- src/settings_gui.cpp | 2 +- src/toolbar_gui.cpp | 6 +++--- src/town_gui.cpp | 4 ++-- src/vehicle_gui.cpp | 3 +-- src/window.cpp | 40 --------------------------------------- src/window_gui.h | 26 +++++++++++++++++++++++-- 17 files changed, 58 insertions(+), 88 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index ac9b0448e3..d474643b74 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -107,9 +107,7 @@ struct BuildAirToolbarWindow : Window { if (!gui_scope) return; bool can_build = CanBuildVehicleInfrastructure(VEH_AIRCRAFT); - this->SetWidgetsDisabledState(!can_build, - WID_AT_AIRPORT, - WIDGET_LIST_END); + this->SetWidgetDisabledState(WID_AT_AIRPORT, !can_build); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR); diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 9a1834a3b0..08f6955120 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1800,7 +1800,7 @@ struct BuildVehicleWindow : Window { this->GenerateBuildList(); this->vscroll->SetCount(this->eng_list.size()); - this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WIDGET_LIST_END); + this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD); /* Disable renaming engines in network games if you are not the server. */ this->SetWidgetDisabledState(WID_BV_RENAME, this->sel_engine == INVALID_ENGINE || (_networking && !_network_server)); diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 71689a087e..b10c43bdbf 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1103,7 +1103,7 @@ public: return; } - this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT); bool current_class_valid = this->livery_class == LC_OTHER || this->livery_class >= LC_GROUP_RAIL; if (_settings_client.gui.liveries == LIT_ALL || (_settings_client.gui.liveries == LIT_COMPANY && this->window_number == _local_company)) { @@ -1519,8 +1519,8 @@ public: void OnPaint() override { /* lower the non-selected gender button */ - this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END); - this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2, WIDGET_LIST_END); + this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2); + this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2); /* advanced company manager face selection window */ @@ -1535,44 +1535,44 @@ public: /* Eye colour buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2, - WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R, WIDGET_LIST_END); + WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R); /* Chin buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2, - WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R, WIDGET_LIST_END); + WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R); /* Eyebrows buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2, - WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R, WIDGET_LIST_END); + WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R); /* Lips or (if it a male face with a moustache) moustache buttons */ this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2, - WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R, WIDGET_LIST_END); + WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R); /* Nose buttons | male faces with moustache haven't any nose options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male, - WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R, WIDGET_LIST_END); + WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R); /* Hair buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2, - WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R, WIDGET_LIST_END); + WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R); /* Jacket buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2, - WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R, WIDGET_LIST_END); + WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R); /* Collar buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2, - WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R, WIDGET_LIST_END); + WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R); /* Tie/earring buttons | female faces without earring haven't any earring options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 || (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0), - WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R, WIDGET_LIST_END); + WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R); /* Glasses buttons | faces without glasses haven't any glasses options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0, - WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R, WIDGET_LIST_END); + WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R); this->DrawWidgets(); } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 0acc15a02d..28d5d6ea11 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -755,8 +755,7 @@ struct DepotWindow : Window { WID_D_BUILD, WID_D_CLONE, WID_D_RENAME, - WID_D_AUTOREPLACE, - WIDGET_LIST_END); + WID_D_AUTOREPLACE); this->DrawWidgets(); } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index f2a4d60305..ee3446e7ba 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -128,8 +128,7 @@ struct BuildDocksToolbarWindow : Window { this->SetWidgetsDisabledState(!can_build, WID_DT_DEPOT, WID_DT_STATION, - WID_DT_BUOY, - WIDGET_LIST_END); + WID_DT_BUOY); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER); CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index ab4a332b53..b93c206a39 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -535,7 +535,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == LG_ORIGINAL); this->SetWidgetDisabledState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM, - WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END); + WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW); this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); @@ -545,7 +545,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC), - WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END); + WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN); } /* Disable snowline if not arctic */ diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 721125d62a..cc7992497c 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -519,16 +519,14 @@ public: this->SetWidgetsDisabledState(this->vehicles.size() == 0 || _local_company != this->vli.company, WID_GL_STOP_ALL, WID_GL_START_ALL, - WID_GL_MANAGE_VEHICLES_DROPDOWN, - WIDGET_LIST_END); + WID_GL_MANAGE_VEHICLES_DROPDOWN); /* Disable the group specific function when we select the default group or all vehicles */ this->SetWidgetsDisabledState(IsDefaultGroupID(this->vli.index) || IsAllGroupID(this->vli.index) || _local_company != this->vli.company, WID_GL_DELETE_GROUP, WID_GL_RENAME_GROUP, WID_GL_LIVERY_GROUP, - WID_GL_REPLACE_PROTECTION, - WIDGET_LIST_END); + WID_GL_REPLACE_PROTECTION); /* Disable remaining buttons for non-local companies * Needed while changing _local_company, eg. by cheats @@ -538,8 +536,7 @@ public: */ this->SetWidgetsDisabledState(_local_company != this->vli.company, WID_GL_CREATE_GROUP, - WID_GL_AVAILABLE_VEHICLES, - WIDGET_LIST_END); + WID_GL_AVAILABLE_VEHICLES); /* If not a default group and the group has replace protection, show an enabled replace sprite. */ uint16_t protect_sprite = SPR_GROUP_REPLACE_OFF_TRAIN; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 1f0d626377..7ef06425ce 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -670,8 +670,7 @@ struct MusicWindow : public Window { this->SetWidgetsDisabledState( BaseMusic::GetUsedSet()->num_available == 0, WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE, - WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2, - WIDGET_LIST_END + WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2 ); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 8036a3f629..9a36d51f9a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1280,8 +1280,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetDisabledState(WID_NS_APPLY_CHANGES, !((this->editable && this->modified) || _settings_client.gui.newgrf_developer_tools)); this->SetWidgetsDisabledState(!this->editable, WID_NS_PRESET_LIST, - WID_NS_TOGGLE_PALETTE, - WIDGET_LIST_END + WID_NS_TOGGLE_PALETTE ); this->SetWidgetDisabledState(WID_NS_ADD, !this->editable || this->avail_sel == nullptr || HasBit(this->avail_sel->flags, GCF_INVALID)); this->SetWidgetDisabledState(WID_NS_UPGRADE, !this->editable || this->actives == nullptr || !this->CanUpgradeCurrent()); @@ -1290,8 +1289,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetsDisabledState(disable_all, WID_NS_REMOVE, WID_NS_MOVE_UP, - WID_NS_MOVE_DOWN, - WIDGET_LIST_END + WID_NS_MOVE_DOWN ); const GRFConfig *selected_config = (this->avail_sel == nullptr) ? this->active_sel : this->avail_sel; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 5f5acde8d1..3a2f567aa7 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -350,8 +350,7 @@ struct BuildRoadToolbarWindow : Window { this->SetWidgetsDisabledState(!can_build, WID_ROT_DEPOT, WID_ROT_BUS_STATION, - WID_ROT_TRUCK_STATION, - WIDGET_LIST_END); + WID_ROT_TRUCK_STATION); if (!can_build) { CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 90be17a5d5..c528734191 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -779,7 +779,7 @@ struct ScriptDebugWindow : public Window { this->querystrings[WID_SCRD_BREAK_STR_EDIT_BOX] = &this->break_editbox; - SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN, WIDGET_LIST_END); + SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN); /* Restore the break string value from static variable */ this->break_editbox.text.Assign(this->break_string); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 28a466b927..319e2faf9b 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -386,7 +386,7 @@ struct GameOptionsWindow : Window { void SetTab(int widget) { - this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND); this->LowerWidget(widget); int pane = 0; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 291131b3c5..d02ff5ef42 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2019,9 +2019,9 @@ struct MainToolbarWindow : Window { /* If spectator, disable all construction buttons * ie : Build road, rail, ships, airports and landscaping * Since enabled state is the default, just disable when needed */ - this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE); /* disable company list drop downs, if there are no companies */ - this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT); this->SetWidgetDisabledState(WID_TN_GOAL, Goal::GetNumItems() == 0); this->SetWidgetDisabledState(WID_TN_STORY, StoryPage::GetNumItems() == 0); @@ -2475,7 +2475,7 @@ struct ScenarioEditorToolbarWindow : Window { void OnTimeout() override { - this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD); this->SetWidgetDirty(WID_TE_DATE_BACKWARD); this->SetWidgetDirty(WID_TE_DATE_FORWARD); } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 48e84dc3a6..f66b0c7237 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1169,9 +1169,9 @@ public: void UpdateButtons(bool check_availability) { if (check_availability && _game_mode != GM_EDITOR) { - this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE); this->SetWidgetsDisabledState(_settings_game.economy.found_town != TF_CUSTOM_LAYOUT, - WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM, WIDGET_LIST_END); + WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM); if (_settings_game.economy.found_town != TF_CUSTOM_LAYOUT) town_layout = _settings_game.economy.town_layout; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index bf2f939dad..9758036a13 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2005,8 +2005,7 @@ public: this->SetWidgetsDisabledState(this->vehicles.size() == 0, WID_VL_MANAGE_VEHICLES_DROPDOWN, WID_VL_STOP_ALL, - WID_VL_START_ALL, - WIDGET_LIST_END); + WID_VL_START_ALL); } /* Set text of group by dropdown widget. */ diff --git a/src/window.cpp b/src/window.cpp index 37de6e85ca..4c6643f92e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -523,46 +523,6 @@ void Window::OnFocusLost(bool closing) if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxLostFocus(); } -/** - * Sets the enabled/disabled status of a list of widgets. - * By default, widgets are enabled. - * On certain conditions, they have to be disabled. - * @param disab_stat status to use ie: disabled = true, enabled = false - * @param widgets list of widgets ended by WIDGET_LIST_END - */ -void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...) -{ - va_list wdg_list; - - va_start(wdg_list, widgets); - - while (widgets != WIDGET_LIST_END) { - SetWidgetDisabledState(widgets, disab_stat); - widgets = va_arg(wdg_list, int); - } - - va_end(wdg_list); -} - -/** - * Sets the lowered/raised status of a list of widgets. - * @param lowered_stat status to use ie: lowered = true, raised = false - * @param widgets list of widgets ended by WIDGET_LIST_END - */ -void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...) -{ - va_list wdg_list; - - va_start(wdg_list, widgets); - - while (widgets != WIDGET_LIST_END) { - SetWidgetLoweredState(widgets, lowered_stat); - widgets = va_arg(wdg_list, int); - } - - va_end(wdg_list); -} - /** * Raise the buttons of the window. * @param autoraise Raise only the push buttons of the window. diff --git a/src/window_gui.h b/src/window_gui.h index e5e438f91d..281525797a 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -434,8 +434,30 @@ public: int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const; void RaiseButtons(bool autoraise = false); - void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); - void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); + + /** + * Sets the enabled/disabled status of a list of widgets. + * By default, widgets are enabled. + * On certain conditions, they have to be disabled. + * @param disab_stat status to use ie: disabled = true, enabled = false + * @param widgets list of widgets + */ + template + void SetWidgetsDisabledState(bool disab_stat, Args... widgets) + { + (SetWidgetDisabledState(widgets, disab_stat), ...); + } + + /** + * Sets the lowered/raised status of a list of widgets. + * @param lowered_stat status to use ie: lowered = true, raised = false + * @param widgets list of widgets + */ + template + void SetWidgetsLoweredState(bool lowered_stat, Args... widgets) + { + (SetWidgetLoweredState(widgets, lowered_stat), ...); + } void SetWidgetDirty(byte widget_index) const; void DrawWidgets() const; From 4cf88e068ab269e5045b382b0837e2367f770a84 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 16 Sep 2023 21:55:21 +0200 Subject: [PATCH 02/59] Remove: unused include of cstdarg/stdarg.h --- src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp | 1 - src/3rdparty/squirrel/squirrel/sqbaselib.cpp | 1 - src/3rdparty/squirrel/squirrel/sqcompiler.cpp | 1 - src/stdafx.h | 1 - 4 files changed, 4 deletions(-) diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp index b6efa13148..300fed08e9 100644 --- a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp +++ b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp @@ -1,7 +1,6 @@ /* see copyright notice in squirrel.h */ #include #include -#include #define scstrchr strchr #define scatoi atoi diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp index e69b28f27f..1d4195bea0 100644 --- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp +++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp @@ -13,7 +13,6 @@ #include "sqfuncproto.h" #include "sqclosure.h" #include "sqclass.h" -#include #include #include "../../../safeguards.h" diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp index ab11a2ccd1..668e5a4d27 100644 --- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp +++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp @@ -7,7 +7,6 @@ #include #include "sqpcheader.h" -#include #include "sqopcodes.h" #include "sqstring.h" #include "sqfuncproto.h" diff --git a/src/stdafx.h b/src/stdafx.h index 9d952c106f..9dd3359696 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -53,7 +53,6 @@ #include #include #include -#include #include #include #include From 6580ff1adb835a3a10898a0acec60baac03dcc5c Mon Sep 17 00:00:00 2001 From: PeterN Date: Sun, 17 Sep 2023 11:03:24 +0100 Subject: [PATCH 03/59] Fix #11230: Widget layout also failed for group-less vehicle list window. (#11310) --- src/vehicle_gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 9758036a13..88bb106364 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1529,8 +1529,8 @@ static const NWidgetPart _nested_vehicle_list[] = { NWidget(NWID_HORIZONTAL), NWidget(NWID_VERTICAL), - NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_VL_GROUP_ORDER), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_STATION_VIEW_GROUP, STR_TOOLTIP_GROUP_ORDER), - NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VL_SORT_ORDER), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), + NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_VL_GROUP_ORDER), SetMinimalSize(0, 12), SetFill(1, 1), SetDataTip(STR_STATION_VIEW_GROUP, STR_TOOLTIP_GROUP_ORDER), + NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_VL_SORT_ORDER), SetMinimalSize(0, 12), SetFill(1, 1), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), EndContainer(), NWidget(NWID_VERTICAL), NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_VL_GROUP_BY_PULLDOWN), SetMinimalSize(0, 12), SetFill(1, 0), SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER), From 7ef22af2bbeba369e46158794eb3d10b0f83a979 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 17 Sep 2023 06:40:28 +0200 Subject: [PATCH 04/59] Codechange: introduce and use function to raise and dirty a set of widgets when they are lowered --- src/genworld_gui.cpp | 22 +++++----------------- src/industry_gui.cpp | 5 +---- src/network/network_gui.cpp | 8 +------- src/terraform_gui.cpp | 5 +---- src/toolbar_gui.cpp | 5 +---- src/window_gui.h | 22 ++++++++++++++++++++++ 6 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index b93c206a39..5dbd1c59b0 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -884,16 +884,10 @@ struct GenerateLandscapeWindow : public Window { void OnTimeout() override { - static const int newgame_raise_widgets[] = {WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WIDGET_LIST_END}; - static const int heightmap_raise_widgets[] = {WID_GL_HEIGHTMAP_HEIGHT_DOWN, WID_GL_HEIGHTMAP_HEIGHT_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WIDGET_LIST_END}; - - const int *widget = (mode == GLWM_HEIGHTMAP) ? heightmap_raise_widgets : newgame_raise_widgets; - - for (; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } + if (mode == GLWM_HEIGHTMAP) { + this->RaiseWidgetsWhenLowered(WID_GL_HEIGHTMAP_HEIGHT_DOWN, WID_GL_HEIGHTMAP_HEIGHT_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN); + } else { + this->RaiseWidgetsWhenLowered(WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN); } } @@ -1232,13 +1226,7 @@ struct CreateScenarioWindow : public Window void OnTimeout() override { - static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; - for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } - } + this->RaiseWidgetsWhenLowered(WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP); } void OnDropdownSelect(int widget, int index) override diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index e68a6373d7..1a1823a526 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -2922,10 +2922,7 @@ struct IndustryCargoesWindow : public Window { { if (!gui_scope) return; if (data == NUM_INDUSTRYTYPES) { - if (this->IsWidgetLowered(WID_IC_NOTIFY)) { - this->RaiseWidget(WID_IC_NOTIFY); - this->SetWidgetDirty(WID_IC_NOTIFY); - } + this->RaiseWidgetWhenLowered(WID_IC_NOTIFY); return; } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 0270f60713..2215a0cd6b 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -1180,13 +1180,7 @@ struct NetworkStartServerWindow : public Window { void OnTimeout() override { - static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WIDGET_LIST_END}; - for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } - } + this->RaiseWidgetsWhenLowered(WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU); } void OnQueryTextFinished(char *str) override diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index d24cbcc5d4..d7c525b3e4 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -649,10 +649,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { { for (uint i = WID_ETT_START; i < this->nested_array_size; i++) { if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons - if (this->IsWidgetLowered(i)) { - this->RaiseWidget(i); - this->SetWidgetDirty(i); - } + this->RaiseWidgetWhenLowered(i); } } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index d02ff5ef42..0195a710cf 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2128,10 +2128,7 @@ struct MainToolbarWindow : Window { /* We do not want to automatically raise the pause, fast forward and * switchbar buttons; they have to stay down when pressed etc. */ for (uint i = WID_TN_SETTINGS; i < WID_TN_SWITCH_BAR; i++) { - if (this->IsWidgetLowered(i)) { - this->RaiseWidget(i); - this->SetWidgetDirty(i); - } + this->RaiseWidgetWhenLowered(i); } } diff --git a/src/window_gui.h b/src/window_gui.h index 281525797a..03f251a52b 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -413,6 +413,18 @@ public: SetWidgetLoweredState(widget_index, false); } + /** + * Marks a widget as raised and dirty (redraw), when it is marked as lowered. + * @param widget_index index of this widget in the window + */ + inline void RaiseWidgetWhenLowered(byte widget_index) + { + if (this->IsWidgetLowered(widget_index)) { + this->RaiseWidget(widget_index); + this->SetWidgetDirty(widget_index); + } + } + /** * Gets the lowered state of a widget. * @param widget_index index of this widget in the window @@ -458,6 +470,16 @@ public: { (SetWidgetLoweredState(widgets, lowered_stat), ...); } + + /** + * Raises the widgets and sets widgets dirty that are lowered. + * @param widgets list of widgets + */ + template + void RaiseWidgetsWhenLowered(Args... widgets) { + (this->RaiseWidgetWhenLowered(widgets), ...); + } + void SetWidgetDirty(byte widget_index) const; void DrawWidgets() const; From 9d1b131c4421b2c5cd4b0fe24ecb7d24df626d45 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 23 May 2023 08:33:49 +0100 Subject: [PATCH 05/59] Codechange: Use correct constant for invalid cargo type. --- src/industry_gui.cpp | 57 ++++++++++++++++++++------------------- src/linkgraph/linkgraph.h | 2 +- src/train_gui.cpp | 2 +- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 1a1823a526..67a74e61bd 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1947,15 +1947,15 @@ struct CargoesField { CargoID other_accepted[MAX_CARGOES]; ///< Cargoes accepted but not used in this figure. } industry; ///< Industry data (for #CFT_INDUSTRY). struct { - CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #INVALID_CARGO). + CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #CT_INVALID). byte num_cargoes; ///< Number of cargoes. - CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #INVALID_CARGO). + CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #CT_INVALID). byte top_end; ///< Stop at the top of the vertical cargoes. - CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #INVALID_CARGO). + CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #CT_INVALID). byte bottom_end; ///< Stop at the bottom of the vertical cargoes. } cargo; ///< Cargo data (for #CFT_CARGO). struct { - CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #INVALID_CARGO). + CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #CT_INVALID). bool left_align; ///< Align all cargo texts to the left (else align to the right). } cargo_label; ///< Label data (for #CFT_CARGO_LABEL). StringID header; ///< Header text (for #CFT_HEADER). @@ -1979,8 +1979,8 @@ struct CargoesField { { this->type = CFT_INDUSTRY; this->u.industry.ind_type = ind_type; - MemSetT(this->u.industry.other_accepted, INVALID_CARGO, MAX_CARGOES); - MemSetT(this->u.industry.other_produced, INVALID_CARGO, MAX_CARGOES); + MemSetT(this->u.industry.other_accepted, CT_INVALID, MAX_CARGOES); + MemSetT(this->u.industry.other_produced, CT_INVALID, MAX_CARGOES); } /** @@ -2031,7 +2031,7 @@ struct CargoesField { /** * Make a piece of cargo column. - * @param cargoes Array of #CargoID (may contain #INVALID_CARGO). + * @param cargoes Array of #CargoID (may contain #CT_INVALID). * @param length Number of cargoes in \a cargoes. * @param count Number of cargoes to display (should be at least the number of valid cargoes, or \c -1 to let the method compute it). * @param top_end This is the first cargo field of this column. @@ -2050,16 +2050,16 @@ struct CargoesField { } } this->u.cargo.num_cargoes = (count < 0) ? num : count; - for (; num < MAX_CARGOES; num++) this->u.cargo.vertical_cargoes[num] = INVALID_CARGO; + for (; num < MAX_CARGOES; num++) this->u.cargo.vertical_cargoes[num] = CT_INVALID; this->u.cargo.top_end = top_end; this->u.cargo.bottom_end = bottom_end; - MemSetT(this->u.cargo.supp_cargoes, INVALID_CARGO, MAX_CARGOES); - MemSetT(this->u.cargo.cust_cargoes, INVALID_CARGO, MAX_CARGOES); + MemSetT(this->u.cargo.supp_cargoes, CT_INVALID, MAX_CARGOES); + MemSetT(this->u.cargo.cust_cargoes, CT_INVALID, MAX_CARGOES); } /** * Make a field displaying cargo type names. - * @param cargoes Array of #CargoID (may contain #INVALID_CARGO). + * @param cargoes Array of #CargoID (may contain #CT_INVALID). * @param length Number of cargoes in \a cargoes. * @param left_align ALign texts to the left (else to the right). */ @@ -2068,7 +2068,7 @@ struct CargoesField { this->type = CFT_CARGO_LABEL; uint i; for (i = 0; i < MAX_CARGOES && i < length; i++) this->u.cargo_label.cargoes[i] = cargoes[i]; - for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = INVALID_CARGO; + for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = CT_INVALID; this->u.cargo_label.left_align = left_align; } @@ -2244,7 +2244,7 @@ struct CargoesField { * @param left Left industry neighbour if available (else \c nullptr should be supplied). * @param right Right industry neighbour if available (else \c nullptr should be supplied). * @param pt Click position in the cargo field. - * @return Cargo clicked at, or #INVALID_CARGO if none. + * @return Cargo clicked at, or #CT_INVALID if none. */ CargoID CargoClickedAt(const CargoesField *left, const CargoesField *right, Point pt) const { @@ -2263,11 +2263,11 @@ struct CargoesField { int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.width; uint row; for (row = 0; row < MAX_CARGOES; row++) { - if (pt.y < vpos) return INVALID_CARGO; + if (pt.y < vpos) return CT_INVALID; if (pt.y < vpos + FONT_HEIGHT_NORMAL) break; vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.width; } - if (row == MAX_CARGOES) return INVALID_CARGO; + if (row == MAX_CARGOES) return CT_INVALID; /* row = 0 -> at first horizontal row, row = 1 -> second horizontal row, 2 = 3rd horizontal row. */ if (col == 0) { @@ -2276,7 +2276,7 @@ struct CargoesField { if (left->type == CFT_INDUSTRY) return left->u.industry.other_produced[row]; if (left->type == CFT_CARGO_LABEL && !left->u.cargo_label.left_align) return left->u.cargo_label.cargoes[row]; } - return INVALID_CARGO; + return CT_INVALID; } if (col == this->u.cargo.num_cargoes) { if (IsValidCargoID(this->u.cargo.cust_cargoes[row])) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; @@ -2284,24 +2284,25 @@ struct CargoesField { if (right->type == CFT_INDUSTRY) return right->u.industry.other_accepted[row]; if (right->type == CFT_CARGO_LABEL && right->u.cargo_label.left_align) return right->u.cargo_label.cargoes[row]; } - return INVALID_CARGO; + return CT_INVALID; } if (row >= col) { /* Clicked somewhere in-between vertical cargo connection. * Since the horizontal connection is made in the same order as the vertical list, the above condition * ensures we are left-below the main diagonal, thus at the supplying side. */ - return (IsValidCargoID(this->u.cargo.supp_cargoes[row])) ? this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]] : INVALID_CARGO; - } else { - /* Clicked at a customer connection. */ - return (IsValidCargoID(this->u.cargo.cust_cargoes[row])) ? this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]] : INVALID_CARGO; + if (IsValidCargoID(this->u.cargo.supp_cargoes[row])) return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]]; + return CT_INVALID; } + /* Clicked at a customer connection. */ + if (IsValidCargoID(this->u.cargo.cust_cargoes[row])) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; + return CT_INVALID; } /** * Decide what cargo the user clicked in the cargo label field. * @param pt Click position in the cargo label field. - * @return Cargo clicked at, or #INVALID_CARGO if none. + * @return Cargo clicked at, or #CT_INVALID if none. */ CargoID CargoLabelClickedAt(Point pt) const { @@ -2310,11 +2311,11 @@ struct CargoesField { int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.height; uint row; for (row = 0; row < MAX_CARGOES; row++) { - if (pt.y < vpos) return INVALID_CARGO; + if (pt.y < vpos) return CT_INVALID; if (pt.y < vpos + FONT_HEIGHT_NORMAL) break; vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height; } - if (row == MAX_CARGOES) return INVALID_CARGO; + if (row == MAX_CARGOES) return CT_INVALID; return this->u.cargo_label.cargoes[row]; } @@ -2369,7 +2370,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column + 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_produced, INVALID_CARGO, MAX_CARGOES); + MemSetT(ind_fld->u.industry.other_produced, CT_INVALID, MAX_CARGOES); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Produced cargoes not carried in the cargo column. @@ -2403,7 +2404,7 @@ struct CargoesRow { void MakeCargoLabel(int column, bool accepting) { CargoID cargoes[MAX_CARGOES]; - MemSetT(cargoes, INVALID_CARGO, lengthof(cargoes)); + MemSetT(cargoes, CT_INVALID, lengthof(cargoes)); CargoesField *label_fld = this->columns + column; CargoesField *cargo_fld = this->columns + (accepting ? column - 1 : column + 1); @@ -2427,7 +2428,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column - 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_accepted, INVALID_CARGO, MAX_CARGOES); + MemSetT(ind_fld->u.industry.other_accepted, CT_INVALID, MAX_CARGOES); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Accepted cargoes not carried in the cargo column. @@ -3110,7 +3111,7 @@ struct IndustryCargoesWindow : public Window { if (!CalculatePositionInWidget(pt, &fieldxy, &xy)) return false; const CargoesField *fld = this->fields[fieldxy.y].columns + fieldxy.x; - CargoID cid = INVALID_CARGO; + CargoID cid = CT_INVALID; switch (fld->type) { case CFT_CARGO: { CargoesField *lft = (fieldxy.x > 0) ? this->fields[fieldxy.y].columns + fieldxy.x - 1 : nullptr; diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index 57fe6a3fb3..ff1778e0c7 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -189,7 +189,7 @@ public: } /** Bare constructor, only for save/load. */ - LinkGraph() : cargo(INVALID_CARGO), last_compression(0) {} + LinkGraph() : cargo(CT_INVALID), last_compression(0) {} /** * Real constructor. * @param cargo Cargo the link graph is about. diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 4b7bbf2120..ebdfa29f0c 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -274,7 +274,7 @@ static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary &su if (!v->GetEngine()->CanCarryCargo()) continue; CargoSummaryItem new_item; - new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : INVALID_CARGO; + new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : (CargoID)CT_INVALID; new_item.subtype = GetCargoSubtypeText(v); if (!IsValidCargoID(new_item.cargo) && new_item.subtype == STR_EMPTY) continue; From 14bcfff6f517dee0f8010d89016fe2008619ef21 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 23 May 2023 08:35:47 +0100 Subject: [PATCH 06/59] Codechange: Rename INVALID_CARGO to INVALID_CARGO_BITNUM ... to avoid future ambiguity. --- src/cargotype.cpp | 6 +++--- src/cargotype.h | 6 +++--- src/table/cargo_const.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 2e903f4603..6db3a8caf9 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -44,7 +44,7 @@ void SetupCargoForClimate(LandscapeID l) /* Reset and disable all cargo types */ for (CargoID i = 0; i < lengthof(CargoSpec::array); i++) { *CargoSpec::Get(i) = {}; - CargoSpec::Get(i)->bitnum = INVALID_CARGO; + CargoSpec::Get(i)->bitnum = INVALID_CARGO_BITNUM; /* Set defaults for newer properties, which old GRFs do not know */ CargoSpec::Get(i)->multiplier = 0x100; @@ -60,7 +60,7 @@ void SetupCargoForClimate(LandscapeID l) /* Copy the indexed cargo */ CargoSpec *cargo = CargoSpec::Get(i); *cargo = _default_cargo[cl]; - if (cargo->bitnum != INVALID_CARGO) SetBit(_cargo_mask, i); + if (cargo->bitnum != INVALID_CARGO_BITNUM) SetBit(_cargo_mask, i); continue; } @@ -123,7 +123,7 @@ CargoID GetCargoIDByLabel(CargoLabel cl) */ CargoID GetCargoIDByBitnum(uint8_t bitnum) { - if (bitnum == INVALID_CARGO) return CT_INVALID; + if (bitnum == INVALID_CARGO_BITNUM) return CT_INVALID; for (const CargoSpec *cs : CargoSpec::Iterate()) { if (cs->bitnum == bitnum) return cs->Index(); diff --git a/src/cargotype.h b/src/cargotype.h index a4f7d503d8..c0c465c52e 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -50,11 +50,11 @@ enum CargoClass { CC_SPECIAL = 1 << 15, ///< Special bit used for livery refit tricks instead of normal cargoes. }; -static const byte INVALID_CARGO = 0xFF; ///< Constant representing invalid cargo +static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo /** Specification of a cargo type. */ struct CargoSpec { - uint8_t bitnum; ///< Cargo bit number, is #INVALID_CARGO for a non-used spec. + uint8_t bitnum; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. CargoLabel label; ///< Unique label of the cargo type. uint8_t legend_colour; uint8_t rating_colour; @@ -97,7 +97,7 @@ struct CargoSpec { */ inline bool IsValid() const { - return this->bitnum != INVALID_CARGO; + return this->bitnum != INVALID_CARGO_BITNUM; } /** diff --git a/src/table/cargo_const.h b/src/table/cargo_const.h index 51e6818b1d..55e9aa2c24 100644 --- a/src/table/cargo_const.h +++ b/src/table/cargo_const.h @@ -27,7 +27,7 @@ * And the following sprite: * - SPR_CARGO_ * - * @param bt Cargo bit number, is #INVALID_CARGO for a non-used spec. + * @param bt Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. * @param label Unique label of the cargo type. * @param colour CargoSpec->legend_colour and CargoSpec->rating_colour. * @param weight Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). From 3afb732c37f5b631e93d40a434f3cede349648e5 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 17 Sep 2023 13:24:07 +0100 Subject: [PATCH 07/59] Fix #11307: Incorrect GroupStatistics after selling leading wagon When this results in a countable consist --- src/train_cmd.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 0958fb582c..877e2d7e3b 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1421,16 +1421,18 @@ CommandCost CmdSellRailWagon(DoCommandFlag flags, Vehicle *t, bool sell_chain, b /* First normalise the sub types of the chain. */ NormaliseSubtypes(new_head); - if (v == first && v->IsEngine() && !sell_chain && new_head != nullptr && new_head->IsFrontEngine()) { - /* We are selling the front engine. In this case we want to - * 'give' the order, unit number and such to the new head. */ - new_head->orders = first->orders; - new_head->AddToShared(first); - DeleteVehicleOrders(first); - - /* Copy other important data from the front engine */ - new_head->CopyVehicleConfigAndStatistics(first); - GroupStatistics::CountVehicle(new_head, 1); // after copying over the profit + if (v == first && !sell_chain && new_head != nullptr && new_head->IsFrontEngine()) { + if (v->IsEngine()) { + /* We are selling the front engine. In this case we want to + * 'give' the order, unit number and such to the new head. */ + new_head->orders = first->orders; + new_head->AddToShared(first); + DeleteVehicleOrders(first); + + /* Copy other important data from the front engine */ + new_head->CopyVehicleConfigAndStatistics(first); + } + GroupStatistics::CountVehicle(new_head, 1); // after copying over the profit, if required } else if (v->IsPrimaryVehicle() && backup_order) { OrderBackup::Backup(v, user); } From 09a7902d369fffcabc9648ed000208a5d40e19fc Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 17 Sep 2023 16:08:37 +0200 Subject: [PATCH 08/59] Fix 8ab0936: missed WIDGET_LIST_END removals --- src/vehicle_gui.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 88bb106364..b1832826a8 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2616,8 +2616,7 @@ struct VehicleDetailsWindow : Window { /* Disable service-scroller when interval is set to disabled */ this->SetWidgetsDisabledState(!IsVehicleServiceIntervalEnabled(v->type, v->owner), WID_VD_INCREASE_SERVICING_INTERVAL, - WID_VD_DECREASE_SERVICING_INTERVAL, - WIDGET_LIST_END); + WID_VD_DECREASE_SERVICING_INTERVAL); StringID str = v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT : STR_VEHICLE_DETAILS_DAYS) : @@ -2657,9 +2656,7 @@ struct VehicleDetailsWindow : Window { WID_VD_DETAILS_CARGO_CARRIED, WID_VD_DETAILS_TRAIN_VEHICLES, WID_VD_DETAILS_CAPACITY_OF_EACH, - WID_VD_DETAILS_TOTAL_CARGO, - widget, - WIDGET_LIST_END); + WID_VD_DETAILS_TOTAL_CARGO); this->tab = (TrainDetailsWindowTabs)(widget - WID_VD_DETAILS_CARGO_CARRIED); this->SetDirty(); From 3a2509198f4af0b4fc542704dfd9a204014c5904 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 17 Sep 2023 16:24:29 +0200 Subject: [PATCH 09/59] Codechange: use better location for the "invalid" action sentinel value It used to be a random sentinel for end-of-(widget-)list that was used to tell that no action has taken place yet. Since the last action is practically the widget that was pressed, add the sentinel to that enumeration. --- src/airport_gui.cpp | 2 +- src/rail_gui.cpp | 2 +- src/road_gui.cpp | 2 +- src/terraform_gui.cpp | 4 ++-- src/widget_type.h | 2 -- src/widgets/airport_widget.h | 2 ++ src/widgets/rail_widget.h | 2 ++ src/widgets/road_widget.h | 2 ++ src/widgets/terraform_widget.h | 4 ++++ 9 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index d474643b74..3386f99d62 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -87,7 +87,7 @@ struct BuildAirToolbarWindow : Window { this->InitNested(window_number); this->OnInvalidateData(); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_AT; } void Close() override diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index cd9270f11c..675f27b872 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -414,7 +414,7 @@ struct BuildRailToolbarWindow : Window { this->InitNested(TRANSPORT_RAIL); this->SetupRailToolbar(railtype); this->DisableWidget(WID_RAT_REMOVE); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_RAT; if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); } diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 3a2f567aa7..2d7cfa763a 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -324,7 +324,7 @@ struct BuildRoadToolbarWindow : Window { } this->OnInvalidateData(); - this->last_started_action = WIDGET_LIST_END; + this->last_started_action = INVALID_WID_ROT; if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); } diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index d7c525b3e4..f68e675a11 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -161,7 +161,7 @@ struct TerraformToolbarWindow : Window { /* This is needed as we like to have the tree available on OnInit. */ this->CreateNestedTree(); this->FinishInitNested(window_number); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_TT; } ~TerraformToolbarWindow() @@ -542,7 +542,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { NWidgetStacked *show_desert = this->GetWidget(WID_ETT_SHOW_PLACE_DESERT); show_desert->SetDisplayedPlane(_settings_game.game_creation.landscape == LT_TROPIC ? 0 : SZSP_NONE); this->FinishInitNested(window_number); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_ETT; } void OnPaint() override diff --git a/src/widget_type.h b/src/widget_type.h index f00577e9c4..ffa8980111 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -17,8 +17,6 @@ #include "gfx_type.h" #include "window_type.h" -static const int WIDGET_LIST_END = -1; ///< indicate the end of widgets' list for vararg functions - /** Bits of the #WWT_MATRIX widget data. */ enum MatrixWidgetValues { /* Number of column bits of the WWT_MATRIX widget data. */ diff --git a/src/widgets/airport_widget.h b/src/widgets/airport_widget.h index 75b805031c..f923512199 100644 --- a/src/widgets/airport_widget.h +++ b/src/widgets/airport_widget.h @@ -14,6 +14,8 @@ enum AirportToolbarWidgets { WID_AT_AIRPORT, ///< Build airport button. WID_AT_DEMOLISH, ///< Demolish button. + + INVALID_WID_AT = -1, }; /** Widgets of the #BuildAirportWindow class. */ diff --git a/src/widgets/rail_widget.h b/src/widgets/rail_widget.h index 4b5b7f41c2..479915cc01 100644 --- a/src/widgets/rail_widget.h +++ b/src/widgets/rail_widget.h @@ -28,6 +28,8 @@ enum RailToolbarWidgets { WID_RAT_BUILD_TUNNEL, ///< Build a tunnel. WID_RAT_REMOVE, ///< Bulldozer to remove rail. WID_RAT_CONVERT_RAIL, ///< Convert other rail to this type. + + INVALID_WID_RAT = -1, }; /** Widgets of the #BuildRailStationWindow class. */ diff --git a/src/widgets/road_widget.h b/src/widgets/road_widget.h index fa23631ba1..58825f1fe2 100644 --- a/src/widgets/road_widget.h +++ b/src/widgets/road_widget.h @@ -26,6 +26,8 @@ enum RoadToolbarWidgets { WID_ROT_BUILD_TUNNEL, ///< Build tunnel. WID_ROT_REMOVE, ///< Remove road. WID_ROT_CONVERT_ROAD, ///< Convert road. + + INVALID_WID_ROT = -1, }; /** Widgets of the #BuildRoadDepotWindow class. */ diff --git a/src/widgets/terraform_widget.h b/src/widgets/terraform_widget.h index 0fd216d721..777a2beb64 100644 --- a/src/widgets/terraform_widget.h +++ b/src/widgets/terraform_widget.h @@ -22,6 +22,8 @@ enum TerraformToolbarWidgets { WID_TT_PLANT_TREES, ///< Plant trees button (note: opens separate window, no place-push-button). WID_TT_PLACE_SIGN, ///< Place sign button. WID_TT_PLACE_OBJECT, ///< Place object button. + + INVALID_WID_TT = -1, }; /** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */ @@ -42,6 +44,8 @@ enum EditorTerraformToolbarWidgets { WID_ETT_DECREASE_SIZE, ///< Downwards arrow button to decrease terraforming size. WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario. WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property. + + INVALID_WID_ETT = -1, }; #endif /* WIDGETS_TERRAFORM_WIDGET_H */ From c6864637fb1a8592eca726d3b9d89c4fe9b13dd8 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 17 Sep 2023 19:47:55 +0200 Subject: [PATCH 10/59] Add: [GitHub] also test if release builds without asserts are warning-free (#11309) --- .github/workflows/ci-build.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 677fc03db4..dfdfbf0371 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -73,10 +73,15 @@ jobs: fail-fast: false matrix: include: - - name: Clang + - name: Clang - Debug compiler: clang cxxcompiler: clang++ libraries: libsdl2-dev + - name: Clang - Release + compiler: clang + cxxcompiler: clang++ + libraries: libsdl2-dev + extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF - name: GCC - SDL2 compiler: gcc cxxcompiler: g++ From e8cbc3c2c78eb88c5b9cd33ccbb40b1bc1aca114 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 27 Apr 2023 13:26:10 +0100 Subject: [PATCH 11/59] Codechange: Simplify initialization of default cargoes. --- src/cargotype.cpp | 8 +------- src/cargotype.h | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 6db3a8caf9..885f96a49b 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -42,13 +42,7 @@ void SetupCargoForClimate(LandscapeID l) assert(l < lengthof(_default_climate_cargo)); /* Reset and disable all cargo types */ - for (CargoID i = 0; i < lengthof(CargoSpec::array); i++) { - *CargoSpec::Get(i) = {}; - CargoSpec::Get(i)->bitnum = INVALID_CARGO_BITNUM; - - /* Set defaults for newer properties, which old GRFs do not know */ - CargoSpec::Get(i)->multiplier = 0x100; - } + std::fill(std::begin(CargoSpec::array), std::end(CargoSpec::array), CargoSpec{}); _cargo_mask = 0; diff --git a/src/cargotype.h b/src/cargotype.h index c0c465c52e..788a73046b 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -54,12 +54,12 @@ static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invali /** Specification of a cargo type. */ struct CargoSpec { - uint8_t bitnum; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. + uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. CargoLabel label; ///< Unique label of the cargo type. uint8_t legend_colour; uint8_t rating_colour; uint8_t weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). - uint16_t multiplier; ///< Capacity multiplier for vehicles. (8 fractional bits) + uint16_t multiplier{0x100}; ///< Capacity multiplier for vehicles. (8 fractional bits) int32_t initial_payment; ///< Initial payment rate before inflation is applied. uint8_t transit_periods[2]; From 280dce95435091a2c0dc2f0a40dad197b71ffcfe Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 17 Sep 2023 17:42:34 +0100 Subject: [PATCH 12/59] Codechange: Reorder CargoSpec to reduce alignment padding. --- src/cargotype.h | 4 ++-- src/table/cargo_const.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargotype.h b/src/cargotype.h index 788a73046b..8173a646d0 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -54,12 +54,13 @@ static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invali /** Specification of a cargo type. */ struct CargoSpec { - uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. CargoLabel label; ///< Unique label of the cargo type. + uint8_t bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. uint8_t legend_colour; uint8_t rating_colour; uint8_t weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). uint16_t multiplier{0x100}; ///< Capacity multiplier for vehicles. (8 fractional bits) + uint16_t classes; ///< Classes of this cargo type. @see CargoClass int32_t initial_payment; ///< Initial payment rate before inflation is applied. uint8_t transit_periods[2]; @@ -75,7 +76,6 @@ struct CargoSpec { SpriteID sprite; ///< Icon to display this cargo type, may be \c 0xFFF (which means to resolve an action123 chain). - uint16_t classes; ///< Classes of this cargo type. @see CargoClass const struct GRFFile *grffile; ///< NewGRF where #group belongs to. const struct SpriteGroup *group; diff --git a/src/table/cargo_const.h b/src/table/cargo_const.h index 55e9aa2c24..9d5c4ef0fe 100644 --- a/src/table/cargo_const.h +++ b/src/table/cargo_const.h @@ -44,9 +44,9 @@ * @param classes Classes of this cargo type. @see CargoClass */ #define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, te, str_plural, str_singular, str_volume, classes) \ - {bt, label, colour, colour, weight, mult, ip, {td1, td2}, freight, te, 0, \ + {label, bt, colour, colour, weight, mult, classes, ip, {td1, td2}, freight, te, 0, \ MK_STR_CARGO_PLURAL(str_plural), MK_STR_CARGO_SINGULAR(str_singular), str_volume, MK_STR_QUANTITY(str_plural), MK_STR_ABBREV(str_plural), \ - MK_SPRITE(str_plural), classes, nullptr, nullptr, 0} + MK_SPRITE(str_plural), nullptr, nullptr, 0} /** Cargo types available by default. */ static const CargoSpec _default_cargo[] = { From fd2dd4397feaca12a57046290caa4bfd0f0e2a7f Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sun, 17 Sep 2023 17:53:13 +0100 Subject: [PATCH 13/59] Codechange: Use range-for and iterator to populate default cargo table. --- src/cargotype.cpp | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/cargotype.cpp b/src/cargotype.cpp index 885f96a49b..f764ad2dd7 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -41,35 +41,33 @@ void SetupCargoForClimate(LandscapeID l) { assert(l < lengthof(_default_climate_cargo)); - /* Reset and disable all cargo types */ - std::fill(std::begin(CargoSpec::array), std::end(CargoSpec::array), CargoSpec{}); - _cargo_mask = 0; - for (CargoID i = 0; i < lengthof(_default_climate_cargo[l]); i++) { - CargoLabel cl = _default_climate_cargo[l][i]; + /* Copy from default cargo by label or index. */ + auto insert = std::begin(CargoSpec::array); + for (const CargoLabel &cl : _default_climate_cargo[l]) { - /* Bzzt: check if cl is just an index into the cargo table */ + /* Check if value is an index into the cargo table */ if (cl < lengthof(_default_cargo)) { - /* Copy the indexed cargo */ - CargoSpec *cargo = CargoSpec::Get(i); - *cargo = _default_cargo[cl]; - if (cargo->bitnum != INVALID_CARGO_BITNUM) SetBit(_cargo_mask, i); - continue; - } - - /* Loop through each of the default cargo types to see if - * the label matches */ - for (uint j = 0; j < lengthof(_default_cargo); j++) { - if (_default_cargo[j].label == cl) { - *CargoSpec::Get(i) = _default_cargo[j]; - - /* Populate the available cargo mask */ - SetBit(_cargo_mask, i); - break; + /* Copy the default cargo by index. */ + *insert = _default_cargo[cl]; + } else { + /* Search for label in default cargo types and copy if found. */ + auto found = std::find_if(std::begin(_default_cargo), std::end(_default_cargo), [&cl](const CargoSpec &cs) { return cs.label == cl; }); + if (found != std::end(_default_cargo)) { + *insert = *found; + } else { + /* Index or label is invalid, this should not happen. */ + NOT_REACHED(); } } + + if (insert->IsValid()) SetBit(_cargo_mask, insert->Index()); + ++insert; } + + /* Reset and disable remaining cargo types. */ + std::fill(insert, std::end(CargoSpec::array), CargoSpec{}); } /** From 18e75dbc880b72be78ebd51fb7df341ece6c17c2 Mon Sep 17 00:00:00 2001 From: PeterN Date: Mon, 18 Sep 2023 22:43:03 +0100 Subject: [PATCH 14/59] Fix: Don't produce invalid cargo. (#11314) Production for secondary industries did not always check that the produced cargo type isn't valid. --- src/economy.cpp | 3 ++- src/industry_cmd.cpp | 4 ++++ src/newgrf_industries.cpp | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/economy.cpp b/src/economy.cpp index caf0d2a4f5..758363d3c0 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1169,9 +1169,10 @@ static void TriggerIndustryProduction(Industry *i) } } else { for (auto ita = std::begin(i->accepted); ita != std::end(i->accepted); ++ita) { - if (ita->waiting == 0) continue; + if (ita->waiting == 0 || !IsValidCargoID(ita->cargo)) continue; for (auto itp = std::begin(i->produced); itp != std::end(i->produced); ++itp) { + if (!IsValidCargoID(itp->cargo)) continue; itp->waiting = ClampTo(itp->waiting + (ita->waiting * indspec->input_cargo_multiplier[ita - std::begin(i->accepted)][itp - std::begin(i->produced)] / 256)); } diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 5fbbdb2131..6d5f17e6ac 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1122,6 +1122,9 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data) */ static void ChopLumberMillTrees(Industry *i) { + /* Skip production if cargo slot is invalid. */ + if (!IsValidCargoID(i->produced[0].cargo)) return; + /* We only want to cut trees if all tiles are completed. */ for (TileIndex tile_cur : i->location) { if (i->TileBelongsToIndustry(tile_cur)) { @@ -1160,6 +1163,7 @@ static void ProduceIndustryGoods(Industry *i) IndustryBehaviour indbehav = indsp->behaviour; for (auto &p : i->produced) { + if (!IsValidCargoID(p.cargo)) continue; p.waiting = ClampTo(p.waiting + p.rate); } diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index e0ce836108..acbf5c2d81 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -643,9 +643,11 @@ void IndustryProductionCallback(Industry *ind, int reason) if (group->version < 2) { /* Callback parameters map directly to industry cargo slot indices */ for (uint i = 0; i < group->num_input; i++) { + if (!IsValidCargoID(ind->accepted[i].cargo)) continue; ind->accepted[i].waiting = ClampTo(ind->accepted[i].waiting - DerefIndProd(group->subtract_input[i], deref) * multiplier); } for (uint i = 0; i < group->num_output; i++) { + if (!IsValidCargoID(ind->produced[i].cargo)) continue; ind->produced[i].waiting = ClampTo(ind->produced[i].waiting + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier); } } else { From 9457bda614b11b490a81a4e0631cc9b7398c056a Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 18 Sep 2023 20:30:09 +0100 Subject: [PATCH 15/59] Codechange: Use std::fill instead of memset when initializing GUI cargo fields. --- src/industry_gui.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 67a74e61bd..120b10957a 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1979,8 +1979,8 @@ struct CargoesField { { this->type = CFT_INDUSTRY; this->u.industry.ind_type = ind_type; - MemSetT(this->u.industry.other_accepted, CT_INVALID, MAX_CARGOES); - MemSetT(this->u.industry.other_produced, CT_INVALID, MAX_CARGOES); + std::fill(std::begin(this->u.industry.other_accepted), std::end(this->u.industry.other_accepted), CT_INVALID); + std::fill(std::begin(this->u.industry.other_produced), std::end(this->u.industry.other_produced), CT_INVALID); } /** @@ -2053,8 +2053,8 @@ struct CargoesField { for (; num < MAX_CARGOES; num++) this->u.cargo.vertical_cargoes[num] = CT_INVALID; this->u.cargo.top_end = top_end; this->u.cargo.bottom_end = bottom_end; - MemSetT(this->u.cargo.supp_cargoes, CT_INVALID, MAX_CARGOES); - MemSetT(this->u.cargo.cust_cargoes, CT_INVALID, MAX_CARGOES); + std::fill(std::begin(this->u.cargo.supp_cargoes), std::end(this->u.cargo.supp_cargoes), CT_INVALID); + std::fill(std::begin(this->u.cargo.cust_cargoes), std::end(this->u.cargo.cust_cargoes), CT_INVALID); } /** @@ -2370,7 +2370,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column + 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_produced, CT_INVALID, MAX_CARGOES); + std::fill(std::begin(ind_fld->u.industry.other_produced), std::end(ind_fld->u.industry.other_produced), CT_INVALID); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Produced cargoes not carried in the cargo column. @@ -2404,7 +2404,7 @@ struct CargoesRow { void MakeCargoLabel(int column, bool accepting) { CargoID cargoes[MAX_CARGOES]; - MemSetT(cargoes, CT_INVALID, lengthof(cargoes)); + std::fill(std::begin(cargoes), std::end(cargoes), CT_INVALID); CargoesField *label_fld = this->columns + column; CargoesField *cargo_fld = this->columns + (accepting ? column - 1 : column + 1); @@ -2428,7 +2428,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column - 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_accepted, CT_INVALID, MAX_CARGOES); + std::fill(std::begin(ind_fld->u.industry.other_accepted), std::end(ind_fld->u.industry.other_accepted), CT_INVALID); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Accepted cargoes not carried in the cargo column. From 4f8d06ff7365eb16e936225702b2246e3d9b364c Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 18 Sep 2023 20:31:01 +0100 Subject: [PATCH 16/59] Codechange: Use uint8_t instead of byte for numeric values. --- src/industry_gui.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 120b10957a..db309fadfd 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1948,11 +1948,11 @@ struct CargoesField { } industry; ///< Industry data (for #CFT_INDUSTRY). struct { CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #CT_INVALID). - byte num_cargoes; ///< Number of cargoes. + uint8_t num_cargoes; ///< Number of cargoes. CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #CT_INVALID). - byte top_end; ///< Stop at the top of the vertical cargoes. + uint8_t top_end; ///< Stop at the top of the vertical cargoes. CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #CT_INVALID). - byte bottom_end; ///< Stop at the bottom of the vertical cargoes. + uint8_t bottom_end; ///< Stop at the bottom of the vertical cargoes. } cargo; ///< Cargo data (for #CFT_CARGO). struct { CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #CT_INVALID). From 106f29f76120a22bbee11f91619842f45867b9bb Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 18 Sep 2023 21:55:31 +0100 Subject: [PATCH 17/59] Codechange: Use iteration to copy cargo list into CFT_CARGO. --- src/industry_gui.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index db309fadfd..8b1e510b2d 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -2041,16 +2041,15 @@ struct CargoesField { void MakeCargo(const CargoID *cargoes, uint length, int count = -1, bool top_end = false, bool bottom_end = false) { this->type = CFT_CARGO; - uint i; - uint num = 0; - for (i = 0; i < MAX_CARGOES && i < length; i++) { + auto insert = std::begin(this->u.cargo.vertical_cargoes); + for (uint i = 0; insert != std::end(this->u.cargo.vertical_cargoes) && i < length; i++) { if (IsValidCargoID(cargoes[i])) { - this->u.cargo.vertical_cargoes[num] = cargoes[i]; - num++; + *insert = cargoes[i]; + ++insert; } } - this->u.cargo.num_cargoes = (count < 0) ? num : count; - for (; num < MAX_CARGOES; num++) this->u.cargo.vertical_cargoes[num] = CT_INVALID; + this->u.cargo.num_cargoes = (count < 0) ? static_cast(insert - std::begin(this->u.cargo.vertical_cargoes)) : count; + std::fill(insert, std::end(this->u.cargo.vertical_cargoes), CT_INVALID); this->u.cargo.top_end = top_end; this->u.cargo.bottom_end = bottom_end; std::fill(std::begin(this->u.cargo.supp_cargoes), std::end(this->u.cargo.supp_cargoes), CT_INVALID); From 6fb89b189fc19828260b5eb65a1384d94b7b1c25 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 18 Sep 2023 22:34:55 +0100 Subject: [PATCH 18/59] Fix #11315: Sort industries and cargoes by name* in industry chain window. *Cargo types are sorted by the normal method so it's not strictly alphabetical. --- src/cargotype.cpp | 6 ++++++ src/cargotype.h | 1 + src/industry_gui.cpp | 10 ++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/cargotype.cpp b/src/cargotype.cpp index f764ad2dd7..3b72e49647 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -142,6 +142,7 @@ SpriteID CargoSpec::GetCargoIcon() const return sprite; } +std::array _sorted_cargo_types; ///< Sort order of cargoes by cargo ID. std::vector _sorted_cargo_specs; ///< Cargo specifications sorted alphabetically by name. span _sorted_standard_cargo_specs; ///< Standard cargo specifications sorted alphabetically by name. @@ -186,6 +187,11 @@ void InitializeSortedCargoSpecs() /* Sort cargo specifications by cargo class and name. */ std::sort(_sorted_cargo_specs.begin(), _sorted_cargo_specs.end(), &CargoSpecClassSorter); + /* Populate */ + for (auto it = std::begin(_sorted_cargo_specs); it != std::end(_sorted_cargo_specs); ++it) { + _sorted_cargo_types[(*it)->Index()] = static_cast(it - std::begin(_sorted_cargo_specs)); + } + /* Count the number of standard cargos and fill the mask. */ _standard_cargo_mask = 0; uint8_t nb_standard_cargo = 0; diff --git a/src/cargotype.h b/src/cargotype.h index 8173a646d0..c1ec96882b 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -187,6 +187,7 @@ CargoID GetCargoIDByBitnum(uint8_t bitnum); CargoID GetDefaultCargoID(LandscapeID l, CargoType ct); void InitializeSortedCargoSpecs(); +extern std::array _sorted_cargo_types; extern std::vector _sorted_cargo_specs; extern span _sorted_standard_cargo_specs; diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 8b1e510b2d..354041b37a 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1920,6 +1920,11 @@ enum CargoesFieldType { static const uint MAX_CARGOES = 16; ///< Maximum number of cargoes carried in a #CFT_CARGO field in #CargoesField. +static bool CargoIDSorter(const CargoID &a, const CargoID &b) +{ + return _sorted_cargo_types[a] < _sorted_cargo_types[b]; +} + /** Data about a single field in the #IndustryCargoesWindow panel. */ struct CargoesField { static int vert_inter_industry_space; @@ -2049,6 +2054,7 @@ struct CargoesField { } } this->u.cargo.num_cargoes = (count < 0) ? static_cast(insert - std::begin(this->u.cargo.vertical_cargoes)) : count; + std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, &CargoIDSorter); std::fill(insert, std::end(this->u.cargo.vertical_cargoes), CT_INVALID); this->u.cargo.top_end = top_end; this->u.cargo.bottom_end = bottom_end; @@ -2813,7 +2819,7 @@ struct IndustryCargoesWindow : public Window { /* Add suppliers and customers of the 'it' industry. */ int supp_count = 0; int cust_count = 0; - for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { + for (IndustryType it : _sorted_industry_types) { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; @@ -2881,7 +2887,7 @@ struct IndustryCargoesWindow : public Window { /* Add suppliers and customers of the cargo. */ int supp_count = 0; int cust_count = 0; - for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { + for (IndustryType it : _sorted_industry_types) { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; From 710722e3c1b67927eaf89af6e8205adebc830134 Mon Sep 17 00:00:00 2001 From: translators Date: Tue, 19 Sep 2023 18:38:46 +0000 Subject: [PATCH 19/59] Update: Translations from eints korean: 1 change by telk5093 --- src/lang/korean.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 85a158be10..83cc956c76 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -930,7 +930,7 @@ STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO :{WHITE}{STATION STR_NEWS_STATION_NOW_ACCEPTS_CARGO :{WHITE}{STATION}에서 이제 {STRING}{G 1 "을" "를"} 받을 수 있습니다. STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}{STATION}에서 이제 {STRING}/{STRING}{G 2 "을" "를"} 받을 수 있습니다. -STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 계약 파기:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다. +STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 종료:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다. STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}보조금 지급 만료:{}{}{1:STRING}에서 {2:STRING}까지의{}{0:STRING} 수송 보조금은 더 이상 지급되지 않습니다. STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}보조금 지급 안내{}{}처음으로 {1:STRING}에서 {2:STRING}까지{}{0:STRING}{G 0 "을" "를"} 수송하는 회사는{}지역 당국으로부터 {3:NUM}년 동안 보조금을 받게 될 것입니다! ###length 4 From df400ef84a4fb71c4a8491393335ca57283098c9 Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Tue, 19 Sep 2023 22:16:31 +0200 Subject: [PATCH 20/59] Fix: only count distance traveled in vehicles for cargo payment (#11283) No longer you can utilize the free (and instant) labour of station workers, transporting your cargo from one part of the station to the other. No more! Based on patch by dP. --- src/cargoaction.cpp | 6 ++- src/cargoaction.h | 12 +++-- src/cargopacket.cpp | 11 +++-- src/cargopacket.h | 88 +++++++++++++++++++++++++++++---- src/economy.cpp | 4 +- src/saveload/cargopacket_sl.cpp | 38 ++++++++++++++ src/saveload/saveload.h | 1 + src/vehicle.cpp | 2 +- 8 files changed, 141 insertions(+), 21 deletions(-) diff --git a/src/cargoaction.cpp b/src/cargoaction.cpp index 4766b10882..c70eee9bfb 100644 --- a/src/cargoaction.cpp +++ b/src/cargoaction.cpp @@ -120,7 +120,7 @@ bool CargoLoad::operator()(CargoPacket *cp) { CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) return false; - cp_new->SetSourceXY(this->current_tile); + cp_new->UpdateLoadingTile(this->current_tile); this->source->RemoveFromCache(cp_new, cp_new->Count()); this->destination->Append(cp_new, VehicleCargoList::MTA_KEEP); return cp_new == cp; @@ -135,7 +135,7 @@ bool CargoReservation::operator()(CargoPacket *cp) { CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) return false; - cp_new->SetSourceXY(this->current_tile); + cp_new->UpdateLoadingTile(this->current_tile); this->source->reserved_count += cp_new->Count(); this->source->RemoveFromCache(cp_new, cp_new->Count()); this->destination->Append(cp_new, VehicleCargoList::MTA_LOAD); @@ -152,6 +152,7 @@ bool CargoReturn::operator()(CargoPacket *cp) CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) cp_new = cp; assert(cp_new->Count() <= this->destination->reserved_count); + cp_new->UpdateUnloadingTile(this->current_tile); this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_LOAD, cp_new->Count()); this->destination->reserved_count -= cp_new->Count(); this->destination->Append(cp_new, this->next); @@ -167,6 +168,7 @@ bool CargoTransfer::operator()(CargoPacket *cp) { CargoPacket *cp_new = this->Preprocess(cp); if (cp_new == nullptr) return false; + cp_new->UpdateUnloadingTile(this->current_tile); this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count()); /* No transfer credits here as they were already granted during Stage(). */ this->destination->Append(cp_new, cp_new->GetNextHop()); diff --git a/src/cargoaction.h b/src/cargoaction.h index e58a213c61..c0c58b12cd 100644 --- a/src/cargoaction.h +++ b/src/cargoaction.h @@ -70,9 +70,11 @@ public: /** Action of transferring cargo from a vehicle to a station. */ class CargoTransfer : public CargoMovement { +protected: + TileIndex current_tile; ///< Current tile cargo unloading is happening. public: - CargoTransfer(VehicleCargoList *source, StationCargoList *destination, uint max_move) : - CargoMovement(source, destination, max_move) {} + CargoTransfer(VehicleCargoList *source, StationCargoList *destination, uint max_move, TileIndex current_tile) : + CargoMovement(source, destination, max_move), current_tile(current_tile) {} bool operator()(CargoPacket *cp); }; @@ -96,10 +98,12 @@ public: /** Action of returning previously reserved cargo from the vehicle to the station. */ class CargoReturn : public CargoMovement { +protected: + TileIndex current_tile; ///< Current tile cargo unloading is happening. StationID next; public: - CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move, StationID next) : - CargoMovement(source, destination, max_move), next(next) {} + CargoReturn(VehicleCargoList *source, StationCargoList *destination, uint max_move, StationID next, TileIndex current_tile) : + CargoMovement(source, destination, max_move), current_tile(current_tile), next(next) {} bool operator()(CargoPacket *cp); }; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index 2de793f64f..fc5031d7eb 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -79,8 +79,12 @@ CargoPacket::CargoPacket(uint16_t count, Money feeder_share, CargoPacket &origin periods_in_transit(original.periods_in_transit), feeder_share(feeder_share), source_xy(original.source_xy), + travelled(original.travelled), source_id(original.source_id), source_type(original.source_type), +#ifdef WITH_ASSERT + in_vehicle(original.in_vehicle), +#endif /* WITH_ASSERT */ first_station(original.first_station), next_hop(original.next_hop) { @@ -587,12 +591,13 @@ uint VehicleCargoList::Reassignaction_counts[MTA_LOAD], max_move); - this->PopCargo(CargoReturn(this, dest, max_move, next)); + this->PopCargo(CargoReturn(this, dest, max_move, next, current_tile)); return max_move; } @@ -623,7 +628,7 @@ uint VehicleCargoList::Unload(uint max_move, StationCargoList *dest, CargoPaymen uint moved = 0; if (this->action_counts[MTA_TRANSFER] > 0) { uint move = std::min(this->action_counts[MTA_TRANSFER], max_move); - this->ShiftCargo(CargoTransfer(this, dest, move)); + this->ShiftCargo(CargoTransfer(this, dest, move, current_tile)); moved += move; } if (this->action_counts[MTA_TRANSFER] == 0 && this->action_counts[MTA_DELIVER] > 0 && moved < max_move) { diff --git a/src/cargopacket.h b/src/cargopacket.h index 3ff52d7716..6498760822 100644 --- a/src/cargopacket.h +++ b/src/cargopacket.h @@ -39,15 +39,27 @@ extern SaveLoadTable GetCargoPacketDesc(); */ struct CargoPacket : CargoPacketPool::PoolItem<&_cargopacket_pool> { private: + /* A mathematical vector from (0,0). */ + struct Vector { + int16_t x; + int16_t y; + }; + uint16_t count{0}; ///< The amount of cargo in this packet. uint16_t periods_in_transit{0}; ///< Amount of cargo aging periods this packet has been in transit. Money feeder_share{0}; ///< Value of feeder pickup to be paid for on delivery of cargo. TileIndex source_xy{INVALID_TILE}; ///< The origin of the cargo. + Vector travelled{0, 0}; ///< If cargo is in station: the vector from the unload tile to the source tile. If in vehicle: an intermediate value. + SourceID source_id{INVALID_SOURCE}; ///< Index of industry/town/HQ, INVALID_SOURCE if unknown/invalid. SourceType source_type{SourceType::Industry}; ///< Type of \c source_id. +#ifdef WITH_ASSERT + bool in_vehicle{false}; ///< NOSAVE: Whether this cargo is in a vehicle or not. +#endif /* WITH_ASSERT */ + StationID first_station{INVALID_STATION}; ///< The station where the cargo came from first. StationID next_hop{INVALID_STATION}; ///< Station where the cargo wants to go next. @@ -83,22 +95,51 @@ public: } /** - * Set the origin of the packet. + * Update for the cargo being loaded on this tile. * - * Can only be set once. + * When a CargoPacket is created, it is moved to a station. But at that + * moment in time it is not known yet at which tile the cargo will be + * picked up. As this tile is used for payment information, we delay + * setting the source_xy till first pickup, getting a better idea where + * a cargo started from. * - * When a packet is created, it is moved to a station. But at that moment - * in time it is not known yet at which tile the cargo will be picked up. - * As this tile is used for payment information, we delay setting the - * source_xy till first pickup. + * Further more, we keep track of the amount of tiles the cargo moved + * inside a vehicle. This is used in GetDistance() below. * * @param tile Tile the cargo is being picked up from. */ - void SetSourceXY(TileIndex tile) + void UpdateLoadingTile(TileIndex tile) { if (this->source_xy == INVALID_TILE) { this->source_xy = tile; } + +#ifdef WITH_ASSERT + assert(!this->in_vehicle); + this->in_vehicle = true; +#endif /* WITH_ASSERT */ + + /* We want to calculate the vector from tile-unload to tile-load. As + * we currently only know the latter, add it. When we know where we unload, + * we subtract is, giving us our vector (unload - load). */ + this->travelled.x += TileX(tile); + this->travelled.y += TileY(tile); + } + + /** + * Update for the cargo being unloaded on this tile. + * + * @param tile Tile the cargo is being dropped off at. + */ + void UpdateUnloadingTile(TileIndex tile) + { +#ifdef WITH_ASSERT + assert(this->in_vehicle); + this->in_vehicle = false; +#endif /* WITH_ASSERT */ + + this->travelled.x -= TileX(tile); + this->travelled.y -= TileY(tile); } /** @@ -188,7 +229,36 @@ public: inline uint GetDistance(TileIndex current_tile) const { assert(this->source_xy != INVALID_TILE); - return DistanceManhattan(this->source_xy, current_tile); +#ifdef WITH_ASSERT + assert(this->in_vehicle); +#endif /* WITH_ASSERT */ + + /* Distance is always requested when the cargo is still inside the + * vehicle. So first finish the calculation for travelled to + * become a vector. */ + auto local_travelled = travelled; + local_travelled.x -= TileX(current_tile); + local_travelled.y -= TileY(current_tile); + + /* Cargo-movement is a vector that indicates how much the cargo has + * actually traveled in a vehicle. This is the distance you get paid + * for. However, one could construct a route where this vector would + * be really long. To not overpay the player, cap out at the distance + * between source and destination. + * + * This way of calculating is to counter people moving cargo for free + * and instantly in stations, where you deliver it in one part of the + * station and pick it up in another. By using the actual distance + * traveled in a vehicle, using this trick doesn't give you more money. + * + * However, especially in large networks with large transfer station, + * etc, one could actually make the route a lot longer. In that case, + * use the actual distance between source and destination. + */ + + uint distance_travelled = abs(local_travelled.x) + abs(local_travelled.y); + uint distance_source_dest = DistanceManhattan(this->source_xy, current_tile); + return std::min(distance_travelled, distance_source_dest); } /** @@ -427,7 +497,7 @@ public: template uint Reassign(uint max_move); - uint Return(uint max_move, StationCargoList *dest, StationID next_station); + uint Return(uint max_move, StationCargoList *dest, StationID next_station, TileIndex current_tile); uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment, TileIndex current_tile); uint Shift(uint max_move, VehicleCargoList *dest); uint Truncate(uint max_move = UINT_MAX); diff --git a/src/economy.cpp b/src/economy.cpp index 758363d3c0..bc2bd93878 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1438,7 +1438,7 @@ struct ReturnCargoAction */ bool operator()(Vehicle *v) { - v->cargo.Return(UINT_MAX, &this->st->goods[v->cargo_type].cargo, this->next_hop); + v->cargo.Return(UINT_MAX, &this->st->goods[v->cargo_type].cargo, this->next_hop, v->tile); return true; } }; @@ -1698,7 +1698,7 @@ static void LoadUnloadVehicle(Vehicle *front) uint new_remaining = v->cargo.RemainingCount() + v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER); if (v->cargo_cap < new_remaining) { /* Return some of the reserved cargo to not overload the vehicle. */ - v->cargo.Return(new_remaining - v->cargo_cap, &ge->cargo, INVALID_STATION); + v->cargo.Return(new_remaining - v->cargo_cap, &ge->cargo, INVALID_STATION, v->tile); } /* Keep instead of delivering. This may lead to no cargo being unloaded, so ...*/ diff --git a/src/saveload/cargopacket_sl.cpp b/src/saveload/cargopacket_sl.cpp index dd7036c03f..b5ee7312ca 100644 --- a/src/saveload/cargopacket_sl.cpp +++ b/src/saveload/cargopacket_sl.cpp @@ -76,6 +76,42 @@ if (IsSavegameVersionBefore(SLV_181)) { for (Vehicle *v : Vehicle::Iterate()) v->cargo.KeepAll(); } + + /* Before this version, we didn't track how far cargo actually traveled in vehicles. Make best-effort estimates of this. */ + if (IsSavegameVersionBefore(SLV_CARGO_TRAVELLED)) { + /* Update the cargo-traveled in stations as if they arrived from the source tile. */ + for (Station *st : Station::Iterate()) { + for (size_t i = 0; i < NUM_CARGO; i++) { + GoodsEntry *ge = &st->goods[i]; + for (auto it = ge->cargo.Packets()->begin(); it != ge->cargo.Packets()->end(); it++) { + for (CargoPacket *cp : it->second) { + if (cp->source_xy != INVALID_TILE && cp->source_xy != st->xy) { + cp->travelled.x = TileX(cp->source_xy) - TileX(st->xy); + cp->travelled.y = TileY(cp->source_xy) - TileY(st->xy); + } + } + } + } + } + + /* Update the cargo-traveled in vehicles as if they were loaded at the source tile. */ + for (Vehicle *v : Vehicle::Iterate()) { + for (auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) { + if ((*it)->source_xy != INVALID_TILE) { + (*it)->UpdateLoadingTile((*it)->source_xy); + } + } + } + } + +#ifdef WITH_ASSERT + /* in_vehicle is a NOSAVE; it tells if cargo is in a vehicle or not. Restore the value in here. */ + for (Vehicle *v : Vehicle::Iterate()) { + for (auto it = v->cargo.Packets()->begin(); it != v->cargo.Packets()->end(); it++) { + (*it)->in_vehicle = true; + } + } +#endif /* WITH_ASSERT */ } /** @@ -97,6 +133,8 @@ SaveLoadTable GetCargoPacketDesc() SLE_VAR(CargoPacket, feeder_share, SLE_INT64), SLE_CONDVAR(CargoPacket, source_type, SLE_UINT8, SLV_125, SL_MAX_VERSION), SLE_CONDVAR(CargoPacket, source_id, SLE_UINT16, SLV_125, SL_MAX_VERSION), + SLE_CONDVAR(CargoPacket, travelled.x, SLE_INT16, SLV_CARGO_TRAVELLED, SL_MAX_VERSION), + SLE_CONDVAR(CargoPacket, travelled.y, SLE_INT16, SLV_CARGO_TRAVELLED, SL_MAX_VERSION), }; return _cargopacket_desc; } diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 71e86aecea..df02b235f4 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -360,6 +360,7 @@ enum SaveLoadVersion : uint16_t { SLV_PERIODS_IN_TRANSIT_RENAME, ///< 316 PR#11112 Rename days in transit to (cargo) periods in transit. SLV_NEWGRF_LAST_SERVICE, ///< 317 PR#11124 Added stable date_of_last_service to avoid NewGRF trouble. SLV_REMOVE_LOADED_AT_XY, ///< 318 PR#11276 Remove loaded_at_xy variable from CargoPacket. + SLV_CARGO_TRAVELLED, ///< 319 PR#11283 CargoPacket now tracks how far it travelled inside a vehicle. SL_MAX_VERSION, ///< Highest possible saveload version }; diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 56c17b89ef..901965f379 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -2241,7 +2241,7 @@ void Vehicle::CancelReservation(StationID next, Station *st) VehicleCargoList &cargo = v->cargo; if (cargo.ActionCount(VehicleCargoList::MTA_LOAD) > 0) { Debug(misc, 1, "cancelling cargo reservation"); - cargo.Return(UINT_MAX, &st->goods[v->cargo_type].cargo, next); + cargo.Return(UINT_MAX, &st->goods[v->cargo_type].cargo, next, v->tile); } cargo.KeepAll(); } From b6c8f301bea321fa7ea87795c881247a3dc40078 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 16 Sep 2023 22:20:53 +0200 Subject: [PATCH 21/59] Codechange: Silence warnings about intentionally unused parameters. --- src/3rdparty/squirrel/squirrel/sqbaselib.cpp | 2 +- src/3rdparty/squirrel/squirrel/sqclass.cpp | 2 +- src/3rdparty/squirrel/squirrel/sqobject.h | 2 +- src/3rdparty/squirrel/squirrel/sqstate.cpp | 2 +- src/ai/ai_gui.cpp | 6 +- src/aircraft_cmd.cpp | 16 ++-- src/airport_gui.cpp | 18 ++-- src/autoreplace_gui.cpp | 8 +- src/base_media_func.h | 2 +- src/blitter/32bpp_base.cpp | 2 +- src/blitter/32bpp_sse_func.hpp | 2 +- src/blitter/8bpp_base.cpp | 2 +- src/blitter/null.hpp | 24 +++--- src/bootstrap_gui.cpp | 16 ++-- src/bridge_gui.cpp | 11 ++- src/build_vehicle_gui.cpp | 6 +- src/cheat_gui.cpp | 16 ++-- src/clear_cmd.cpp | 10 +-- src/command.cpp | 7 +- src/command_func.h | 8 +- src/company_gui.cpp | 32 +++---- src/company_manager_face.h | 4 +- src/console_cmds.cpp | 2 +- src/console_gui.cpp | 6 +- src/core/pool_type.hpp | 5 +- src/cpu.cpp | 2 +- src/date_gui.cpp | 6 +- src/depot_gui.cpp | 11 ++- src/disaster_vehicle.cpp | 2 +- src/dock_gui.cpp | 24 +++--- src/engine_gui.cpp | 6 +- src/error_gui.cpp | 6 +- src/fileio.cpp | 2 +- src/fios.cpp | 9 +- src/fios_gui.cpp | 12 +-- src/fontcache.cpp | 2 +- src/fontcache/freetypefontcache.cpp | 2 +- src/fontcache/spritefontcache.h | 2 +- src/framerate_gui.cpp | 10 +-- src/game/game_gui.cpp | 8 +- src/game/game_text.cpp | 8 +- src/gamelog.cpp | 20 ++--- src/genworld_gui.cpp | 16 ++-- src/gfx_layout_fallback.cpp | 4 +- src/goal_gui.cpp | 10 +-- src/graph_gui.cpp | 26 +++--- src/group_gui.cpp | 14 ++- src/help_gui.cpp | 2 +- src/highscore_gui.cpp | 4 +- src/hotkeys.cpp | 2 +- src/industry_cmd.cpp | 12 ++- src/industry_gui.cpp | 37 ++++---- src/intro_gui.cpp | 12 +-- src/landscape.cpp | 10 +-- src/league_gui.cpp | 10 +-- src/linkgraph/linkgraph_gui.cpp | 8 +- src/linkgraph/linkgraph_gui.h | 6 +- src/linkgraph/mcf.cpp | 5 +- src/main_gui.cpp | 6 +- src/misc_cmd.cpp | 6 +- src/misc_gui.cpp | 24 +++--- src/music/allegro_m.cpp | 2 +- src/music/cocoa_m.cpp | 2 +- src/music/extmidi.cpp | 2 +- src/music/null_m.h | 6 +- src/music/win32_m.cpp | 4 +- src/music_gui.cpp | 12 +-- src/network/core/address.cpp | 3 +- src/network/core/http_curl.cpp | 2 +- src/network/core/http_none.cpp | 2 +- src/network/core/http_winhttp.cpp | 2 +- src/network/core/os_abstraction.cpp | 4 +- src/network/core/tcp.cpp | 2 +- src/network/core/tcp.h | 2 +- src/network/core/tcp_admin.cpp | 76 ++++++++--------- src/network/core/tcp_content.cpp | 14 +-- src/network/core/tcp_coordinator.cpp | 34 ++++---- src/network/core/tcp_game.cpp | 90 ++++++++++---------- src/network/core/tcp_stun.cpp | 2 +- src/network/core/tcp_turn.cpp | 6 +- src/network/core/udp.cpp | 4 +- src/network/network_admin.cpp | 2 +- src/network/network_chat_gui.cpp | 10 +-- src/network/network_client.cpp | 12 +-- src/network/network_content.cpp | 2 +- src/network/network_content.h | 8 +- src/network/network_content_gui.cpp | 14 +-- src/network/network_content_gui.h | 2 +- src/network/network_gui.cpp | 69 +++++++-------- src/network/network_query.cpp | 4 +- src/network/network_server.cpp | 10 +-- src/network/network_survey.cpp | 2 +- src/network/network_turn.cpp | 2 +- src/network/network_udp.cpp | 4 +- src/newgrf.cpp | 3 +- src/newgrf_airport.cpp | 4 +- src/newgrf_airport.h | 2 +- src/newgrf_airporttiles.cpp | 4 +- src/newgrf_airporttiles.h | 2 +- src/newgrf_animation_base.h | 4 +- src/newgrf_canal.cpp | 4 +- src/newgrf_commons.h | 2 +- src/newgrf_config.cpp | 5 +- src/newgrf_debug_gui.cpp | 16 ++-- src/newgrf_engine.cpp | 2 +- src/newgrf_engine.h | 2 +- src/newgrf_generic.cpp | 4 +- src/newgrf_gui.cpp | 22 ++--- src/newgrf_house.cpp | 2 +- src/newgrf_house.h | 2 +- src/newgrf_industries.cpp | 2 +- src/newgrf_industries.h | 2 +- src/newgrf_industrytiles.cpp | 4 +- src/newgrf_industrytiles.h | 2 +- src/newgrf_object.cpp | 5 +- src/newgrf_object.h | 2 +- src/newgrf_railtype.cpp | 2 +- src/newgrf_railtype.h | 2 +- src/newgrf_roadstop.cpp | 6 +- src/newgrf_roadstop.h | 2 +- src/newgrf_roadtype.cpp | 2 +- src/newgrf_roadtype.h | 2 +- src/newgrf_spritegroup.cpp | 10 +-- src/newgrf_spritegroup.h | 4 +- src/newgrf_station.cpp | 8 +- src/newgrf_station.h | 2 +- src/newgrf_storage.cpp | 2 +- src/newgrf_town.cpp | 2 +- src/newgrf_town.h | 2 +- src/news_gui.cpp | 16 ++-- src/object_cmd.cpp | 7 +- src/object_gui.cpp | 12 +-- src/order_base.h | 2 +- src/order_gui.cpp | 8 +- src/os/macosx/crashlog_osx.cpp | 3 +- src/os/macosx/font_osx.cpp | 2 +- src/os/unix/crashlog_unix.cpp | 4 +- src/os/unix/font_unix.cpp | 2 +- src/os/unix/unix.cpp | 6 +- src/os/windows/crashlog_win.cpp | 8 +- src/os/windows/font_win32.cpp | 2 +- src/os/windows/win32.cpp | 6 +- src/os/windows/win32_main.cpp | 2 +- src/osk_gui.cpp | 4 +- src/pathfinder/npf/npf.cpp | 8 +- src/pathfinder/npf/queue.cpp | 2 +- src/pathfinder/yapf/yapf_costcache.hpp | 10 +-- src/pathfinder/yapf/yapf_destrail.hpp | 2 +- src/pathfinder/yapf/yapf_rail.cpp | 2 +- src/pathfinder/yapf/yapf_road.cpp | 6 +- src/rail_cmd.cpp | 6 +- src/rail_gui.cpp | 49 ++++++----- src/road_cmd.cpp | 4 +- src/road_gui.cpp | 34 ++++---- src/roadveh.h | 2 +- src/saveload/game_sl.cpp | 2 +- src/saveload/oldloader_sl.cpp | 14 +-- src/saveload/saveload.cpp | 8 +- src/saveload/saveload.h | 16 ++-- src/saveload/town_sl.cpp | 2 +- src/screenshot.cpp | 11 +-- src/screenshot_gui.cpp | 2 +- src/script/api/script_base.cpp | 6 +- src/script/script_gui.cpp | 22 ++--- src/script/script_scanner.cpp | 4 +- src/script/squirrel_helper.hpp | 6 +- src/settings.cpp | 4 +- src/settings_gui.cpp | 24 +++--- src/settings_internal.h | 8 +- src/settings_table.cpp | 52 +++++------ src/settingsgen/settingsgen.cpp | 2 +- src/ship_cmd.cpp | 2 +- src/signs_cmd.cpp | 3 +- src/signs_gui.cpp | 12 +-- src/smallmap_gui.cpp | 8 +- src/smallmap_gui.h | 4 +- src/sound/cocoa_s.cpp | 2 +- src/sound/null_s.h | 2 +- src/sound/sdl2_s.cpp | 3 +- src/sound/sdl_s.cpp | 3 +- src/sound/win32_s.cpp | 2 +- src/station.cpp | 3 +- src/station_cmd.cpp | 6 +- src/station_gui.cpp | 24 +++--- src/statusbar_gui.cpp | 10 +-- src/story_gui.cpp | 8 +- src/strgen/strgen_base.cpp | 6 +- src/strings.cpp | 2 +- src/subsidy_gui.cpp | 6 +- src/table/newgrf_debug_data.h | 46 +++++----- src/terraform_gui.cpp | 25 +++--- src/textfile_gui.cpp | 8 +- src/textfile_gui.h | 4 +- src/tgp.cpp | 2 +- src/timer/timer_game_calendar.cpp | 2 +- src/timer/timer_game_realtime.cpp | 2 +- src/timer/timer_game_tick.cpp | 2 +- src/timer/timer_window.cpp | 2 +- src/timetable_gui.cpp | 8 +- src/toolbar_gui.cpp | 43 +++++----- src/town_cmd.cpp | 14 ++- src/town_gui.cpp | 28 +++--- src/train_gui.cpp | 3 +- src/transparency_gui.cpp | 6 +- src/tree_cmd.cpp | 10 +-- src/tree_gui.cpp | 10 +-- src/vehicle.cpp | 2 +- src/vehicle_base.h | 8 +- src/vehicle_gui.cpp | 32 ++++--- src/video/cocoa/cocoa_v.mm | 2 +- src/video/dedicated_v.cpp | 8 +- src/video/null_v.cpp | 6 +- src/video/opengl.cpp | 2 +- src/video/video_driver.hpp | 2 +- src/video/win32_v.cpp | 2 +- src/video/win32_v.h | 2 +- src/viewport_gui.cpp | 6 +- src/void_cmd.cpp | 14 +-- src/water_cmd.cpp | 12 +-- src/waypoint_base.h | 4 +- src/waypoint_gui.cpp | 4 +- src/widget.cpp | 16 ++-- src/widget_type.h | 2 +- src/widgets/dropdown.cpp | 12 +-- src/widgets/dropdown_type.h | 2 +- src/window.cpp | 4 +- src/window_gui.h | 48 +++++------ 227 files changed, 974 insertions(+), 1041 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp index 1d4195bea0..c79adadfe6 100644 --- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp +++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp @@ -559,7 +559,7 @@ bool _hsort_sift_down(HSQUIRRELVM v,SQArray *arr, SQInteger root, SQInteger bott return true; } -bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger l, SQInteger r,SQInteger func) +bool _hsort(HSQUIRRELVM v,SQObjectPtr &arr, SQInteger, SQInteger,SQInteger func) { SQArray *a = _array(arr); SQInteger i; diff --git a/src/3rdparty/squirrel/squirrel/sqclass.cpp b/src/3rdparty/squirrel/squirrel/sqclass.cpp index eacb0a8c5a..1e75c9ff7c 100644 --- a/src/3rdparty/squirrel/squirrel/sqclass.cpp +++ b/src/3rdparty/squirrel/squirrel/sqclass.cpp @@ -187,7 +187,7 @@ SQInstance::~SQInstance() if(_class){ Finalize(); } //if _class is null it was already finalized by the GC } -bool SQInstance::GetMetaMethod(SQVM *v,SQMetaMethod mm,SQObjectPtr &res) +bool SQInstance::GetMetaMethod(SQVM *,SQMetaMethod mm,SQObjectPtr &res) { if(type(_class->_metamethods[mm]) != OT_NULL) { res = _class->_metamethods[mm]; diff --git a/src/3rdparty/squirrel/squirrel/sqobject.h b/src/3rdparty/squirrel/squirrel/sqobject.h index 77d09301c6..d19aed1f45 100644 --- a/src/3rdparty/squirrel/squirrel/sqobject.h +++ b/src/3rdparty/squirrel/squirrel/sqobject.h @@ -76,7 +76,7 @@ struct SQRefCounted } /* Never used but required. */ - inline void operator delete(void *ptr) { NOT_REACHED(); } + inline void operator delete(void *) { NOT_REACHED(); } private: size_t size; diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp index ce2fdfa55d..b9afb8b134 100644 --- a/src/3rdparty/squirrel/squirrel/sqstate.cpp +++ b/src/3rdparty/squirrel/squirrel/sqstate.cpp @@ -274,7 +274,7 @@ void SQSharedState::EnqueueMarkObject(SQObjectPtr &o,SQGCMarkerQueue &queue) } -SQInteger SQSharedState::CollectGarbage(SQVM *vm) +SQInteger SQSharedState::CollectGarbage(SQVM *) { SQInteger n=0; SQVM *vms = _thread(_root_vm); diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index b3125e8c2e..de8a5fa0b4 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -119,7 +119,7 @@ struct AIConfigWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_AIC_DECREASE_NUMBER: @@ -181,7 +181,7 @@ struct AIConfigWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_AIC_TEXTFILE && widget < WID_AIC_TEXTFILE + TFT_CONTENT_END) { if (this->selected_slot == INVALID_COMPANY || AIConfig::GetConfig(this->selected_slot) == nullptr) return; @@ -267,7 +267,7 @@ struct AIConfigWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!IsEditable(this->selected_slot)) { this->selected_slot = INVALID_COMPANY; diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index ea7dad6d2e..a6c3dad2cd 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1282,7 +1282,7 @@ void HandleMissingAircraftOrders(Aircraft *v) } -TileIndex Aircraft::GetOrderStationLocation(StationID station) +TileIndex Aircraft::GetOrderStationLocation(StationID) { /* Orders are changed in flight, ensure going to the right station. */ if (this->state == FLYING) { @@ -1599,31 +1599,31 @@ static void AircraftEventHandler_AtTerminal(Aircraft *v, const AirportFTAClass * AirportMove(v, apc); } -static void AircraftEventHandler_General(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_General(Aircraft *, const AirportFTAClass *) { FatalError("OK, you shouldn't be here, check your Airport Scheme!"); } -static void AircraftEventHandler_TakeOff(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_TakeOff(Aircraft *v, const AirportFTAClass *) { PlayAircraftSound(v); // play takeoffsound for airplanes v->state = STARTTAKEOFF; } -static void AircraftEventHandler_StartTakeOff(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_StartTakeOff(Aircraft *v, const AirportFTAClass *) { v->state = ENDTAKEOFF; v->UpdateDeltaXY(); } -static void AircraftEventHandler_EndTakeOff(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_EndTakeOff(Aircraft *v, const AirportFTAClass *) { v->state = FLYING; /* get the next position to go to, differs per airport */ AircraftNextAirportPos_and_Order(v); } -static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass *) { v->state = FLYING; v->UpdateDeltaXY(); @@ -1677,7 +1677,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc) v->pos = apc->layout[v->pos].next_position; } -static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *) { v->state = ENDLANDING; AircraftLandAirplane(v); // maybe crash airplane @@ -1690,7 +1690,7 @@ static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *apc } } -static void AircraftEventHandler_HeliLanding(Aircraft *v, const AirportFTAClass *apc) +static void AircraftEventHandler_HeliLanding(Aircraft *v, const AirportFTAClass *) { v->state = HELIENDLANDING; v->UpdateDeltaXY(); diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 3386f99d62..5fe50793ec 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -47,7 +47,7 @@ static void ShowBuildAirportPicker(Window *parent); SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout); -void CcBuildAirport(Commands cmd, const CommandCost &result, TileIndex tile) +void CcBuildAirport(Commands, const CommandCost &result, TileIndex tile) { if (result.Failed()) return; @@ -102,7 +102,7 @@ struct BuildAirToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -118,7 +118,7 @@ struct BuildAirToolbarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_AT_AIRPORT: @@ -138,7 +138,7 @@ struct BuildAirToolbarWindow : Window { } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_AT_AIRPORT: @@ -153,12 +153,12 @@ struct BuildAirToolbarWindow : Window { } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1 && select_proc == DDSP_DEMOLISH_AREA) { GUIPlaceProcDragXY(select_proc, start_tile, end_tile); @@ -316,7 +316,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_AP_CLASS_DROPDOWN: { @@ -487,7 +487,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_AP_CLASS_DROPDOWN: @@ -569,7 +569,7 @@ public: this->SelectFirstAvailableAirport(false); } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index afe9b65fe6..2a0f49e1c9 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -300,7 +300,7 @@ public: this->sel_group = id_g; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_RV_SORT_ASCENDING_DESCENDING: { @@ -539,7 +539,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_RV_SORT_ASCENDING_DESCENDING: @@ -712,7 +712,7 @@ public: } } - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override + bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override { if (widget != WID_RV_TRAIN_WAGONREMOVE_TOGGLE) return false; @@ -736,7 +736,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data != 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ diff --git a/src/base_media_func.h b/src/base_media_func.h index f83c792f92..9ea40f2de8 100644 --- a/src/base_media_func.h +++ b/src/base_media_func.h @@ -153,7 +153,7 @@ bool BaseSet::FillSetDetails(IniFile *ini, const } template -bool BaseMedia::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) +bool BaseMedia::AddFile(const std::string &filename, size_t basepath_length, const std::string &) { bool ret = false; Debug(grf, 1, "Checking {} for base " SET_TYPE " set", filename); diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index a6d71998bd..eef00b404d 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -145,7 +145,7 @@ size_t Blitter_32bppBase::BufferSize(uint width, uint height) return sizeof(uint32_t) * width * height; } -void Blitter_32bppBase::PaletteAnimate(const Palette &palette) +void Blitter_32bppBase::PaletteAnimate(const Palette &) { /* By default, 32bpp doesn't have palette animation */ } diff --git a/src/blitter/32bpp_sse_func.hpp b/src/blitter/32bpp_sse_func.hpp index f0ef4ef266..6215e093b6 100644 --- a/src/blitter/32bpp_sse_func.hpp +++ b/src/blitter/32bpp_sse_func.hpp @@ -154,7 +154,7 @@ static inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness) } GNU_TARGET(SSE_TARGET) -static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32_t brightness) +static inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness) { #if (SSE_VERSION < 3) NOT_REACHED(); diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index ab6f0057c9..a972a27d3d 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -149,7 +149,7 @@ size_t Blitter_8bppBase::BufferSize(uint width, uint height) return static_cast(width) * height; } -void Blitter_8bppBase::PaletteAnimate(const Palette &palette) +void Blitter_8bppBase::PaletteAnimate(const Palette &) { /* Video backend takes care of the palette animation */ } diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp index 9eec944708..26e807c061 100644 --- a/src/blitter/null.hpp +++ b/src/blitter/null.hpp @@ -16,19 +16,19 @@ class Blitter_Null : public Blitter { public: uint8_t GetScreenDepth() override { return 0; } - void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override {}; - void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override {}; + void Draw(Blitter::BlitterParams *, BlitterMode, ZoomLevel) override {}; + void DrawColourMappingRect(void *, int, int, PaletteID) override {}; Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override; - void *MoveTo(void *video, int x, int y) override { return nullptr; }; - void SetPixel(void *video, int x, int y, uint8_t colour) override {}; - void DrawRect(void *video, int width, int height, uint8_t colour) override {}; - void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash) override {}; - void CopyFromBuffer(void *video, const void *src, int width, int height) override {}; - void CopyToBuffer(const void *video, void *dst, int width, int height) override {}; - void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {}; - void ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y) override {}; - size_t BufferSize(uint width, uint height) override { return 0; }; - void PaletteAnimate(const Palette &palette) override { }; + void *MoveTo(void *, int, int) override { return nullptr; }; + void SetPixel(void *, int, int, uint8_t) override {}; + void DrawRect(void *, int, int, uint8_t) override {}; + void DrawLine(void *, int, int, int, int, int, int, uint8_t, int, int) override {}; + void CopyFromBuffer(void *, const void *, int, int) override {}; + void CopyToBuffer(const void *, void *, int, int) override {}; + void CopyImageToBuffer(const void *, void *, int, int, int) override {}; + void ScrollBuffer(void *, int &, int &, int &, int &, int, int) override {}; + size_t BufferSize(uint, uint) override { return 0; }; + void PaletteAnimate(const Palette &) override { }; Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; }; const char *GetName() override { return "null"; } diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 386883c1e2..9859fb6b56 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -56,7 +56,7 @@ public: ResizeWindow(this, _screen.width, _screen.height); } - void DrawWidget(const Rect &r, int widget) const override + void DrawWidget(const Rect &r, int) const override { GfxFillRect(r.left, r.top, r.right, r.bottom, 4, FILLRECT_OPAQUE); GfxFillRect(r.left, r.top, r.right, r.bottom, 0, FILLRECT_CHECKER); @@ -98,7 +98,7 @@ public: this->Window::Close(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_BEM_MESSAGE) { *size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR); @@ -114,7 +114,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget == WID_BEM_QUIT) { _exit_game = true; @@ -159,7 +159,7 @@ public: this->BaseNetworkContentDownloadStatusWindow::Close(); } - void OnDownloadComplete(ContentID cid) override + void OnDownloadComplete(ContentID) override { /* We have completed downloading. We can trigger finding the right set now. */ BaseGraphics::FindSets(); @@ -214,7 +214,7 @@ public: this->Window::Close(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { /* We cache the button size. This is safe as no reinit can happen here. */ if (this->button_size.width == 0) { @@ -244,7 +244,7 @@ public: DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BAFD_YES: @@ -334,7 +334,7 @@ public: EM_ASM({ if (window["openttd_bootstrap"]) openttd_bootstrap($0, $1); }, this->downloaded_bytes, this->total_bytes); } - void OnDownloadProgress(const ContentInfo *ci, int bytes) override + void OnDownloadProgress(const ContentInfo *, int bytes) override { /* A negative value means we are resetting; for example, when retrying or using a fallback. */ if (bytes < 0) { @@ -346,7 +346,7 @@ public: EM_ASM({ if (window["openttd_bootstrap"]) openttd_bootstrap($0, $1); }, this->downloaded_bytes, this->total_bytes); } - void OnDownloadComplete(ContentID cid) override + void OnDownloadComplete(ContentID) override { /* _exit_game is used to break out of the outer video driver's MainLoop. */ _exit_game = true; diff --git a/src/bridge_gui.cpp b/src/bridge_gui.cpp index 367e634411..b7f89ef975 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -50,12 +50,11 @@ typedef GUIList GUIBridgeList; ///< List of bridges, used in #B * Callback executed after a build Bridge CMD has been called * * @param result Whether the build succeeded - * @param cmd unused * @param end_tile End tile of the bridge. * @param tile_start start tile * @param transport_type transport type. */ -void CcBuildBridge(Commands cmd, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte) +void CcBuildBridge(Commands, const CommandCost &result, TileIndex end_tile, TileIndex tile_start, TransportType transport_type, BridgeType, byte) { if (result.Failed()) return; if (_settings_client.sound.confirm) SndPlayTileFx(SND_27_CONSTRUCTION_BRIDGE, end_tile); @@ -175,7 +174,7 @@ public: this->last_sorting = this->bridges.GetListing(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BBS_DROPDOWN_ORDER: { @@ -212,7 +211,7 @@ public: } } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { /* Position the window so hopefully the first bridge from the list is under the mouse pointer. */ NWidgetBase *list = this->GetWidget(WID_BBS_BRIDGE_LIST); @@ -244,7 +243,7 @@ public: } } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { const uint8_t i = keycode - '1'; if (i < 9 && i < this->bridges.size()) { @@ -256,7 +255,7 @@ public: return ES_NOT_HANDLED; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { default: break; diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 08f6955120..707715a28e 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1581,7 +1581,7 @@ struct BuildVehicleWindow : Window { this->eng_list.RebuildDone(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BV_SORT_ASCENDING_DESCENDING: @@ -1688,7 +1688,7 @@ struct BuildVehicleWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* When switching to original acceleration model for road vehicles, clear the selected sort criteria if it is not available now. */ @@ -1736,7 +1736,7 @@ struct BuildVehicleWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BV_LIST: diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 37239d1339..7fa5b42fa0 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -51,11 +51,10 @@ static int32_t _money_cheat_amount = 10000000; * Note that the amount of money of a company must be changed through a command * rather than by setting a variable. Since the cheat data structure expects a * variable, the amount of given/taken money is used for this purpose. - * @param new_value not used. * @param change_direction is -1 or +1 (down/up) * @return Amount of money cheat. */ -static int32_t ClickMoneyCheat(int32_t new_value, int32_t change_direction) +static int32_t ClickMoneyCheat(int32_t, int32_t change_direction) { Command::Post(Money(_money_cheat_amount) * change_direction); return _money_cheat_amount; @@ -83,10 +82,9 @@ static int32_t ClickChangeCompanyCheat(int32_t new_value, int32_t change_directi /** * Allow (or disallow) changing production of all industries. * @param new_value new value - * @param change_direction unused * @return New value allowing change of industry production. */ -static int32_t ClickSetProdCheat(int32_t new_value, int32_t change_direction) +static int32_t ClickSetProdCheat(int32_t new_value, int32_t) { _cheats.setup_prod.value = (new_value != 0); InvalidateWindowClassesData(WC_INDUSTRY_VIEW); @@ -98,10 +96,9 @@ extern void EnginesMonthlyLoop(); /** * Handle changing of the current year. * @param new_value The chosen year to change to. - * @param change_direction +1 (increase) or -1 (decrease). * @return New year. */ -static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction) +static int32_t ClickChangeDateCheat(int32_t new_value, int32_t) { /* Don't allow changing to an invalid year, or the current year. */ auto new_year = Clamp(TimerGameCalendar::Year(new_value), CalendarTime::MIN_YEAR, CalendarTime::MAX_YEAR); @@ -131,11 +128,10 @@ static int32_t ClickChangeDateCheat(int32_t new_value, int32_t change_direction) /** * Allow (or disallow) a change of the maximum allowed heightlevel. * @param new_value new value - * @param change_direction unused * @return New value (or unchanged old value) of the maximum * allowed heightlevel value. */ -static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t change_direction) +static int32_t ClickChangeMaxHlCheat(int32_t new_value, int32_t) { new_value = Clamp(new_value, MIN_MAP_HEIGHT_LIMIT, MAX_MAP_HEIGHT_LIMIT); @@ -301,7 +297,7 @@ struct CheatWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_C_PANEL) return; @@ -347,7 +343,7 @@ struct CheatWindow : Window { size->height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lengthof(_cheats_ui); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { Rect r = this->GetWidget(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect); uint btn = (pt.y - r.top) / this->line_height; diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 6a1132ac2b..5cd00738df 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -127,7 +127,7 @@ static void DrawTile_Clear(TileInfo *ti) DrawBridgeMiddle(ti); } -static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -135,7 +135,7 @@ static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool ground_vehi return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } -static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh) +static Foundation GetFoundation_Clear(TileIndex, Slope) { return FOUNDATION_NONE; } @@ -341,7 +341,7 @@ get_out:; } while (--i); } -static TrackStatus GetTileTrackStatus_Clear(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Clear(TileIndex, TransportType, uint, DiagDirection) { return 0; } @@ -365,12 +365,12 @@ static void GetTileDesc_Clear(TileIndex tile, TileDesc *td) td->owner[0] = GetTileOwner(tile); } -static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_owner) +static void ChangeTileOwner_Clear(TileIndex, Owner, Owner) { return; } -static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) +static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int, Slope) { return Command::Do(flags, tile); } diff --git a/src/command.cpp b/src/command.cpp index dfc82536c4..c2f16a55f6 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -280,11 +280,10 @@ void CommandHelperBase::LogCommandExecution(Commands cmd, StringID err_message, /** * Prepare for the test run of a command proc call. * @param cmd_flags Command flags. - * @param tile Tile of command execution. * @param[in,out] cur_company Backup of current company at start of command execution. * @return True if test run can go ahead, false on error. */ -bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileIndex tile, Backup &cur_company) +bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileIndex, Backup &cur_company) { /* Always execute server and spectator commands as spectator */ bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0; @@ -314,7 +313,7 @@ bool CommandHelperBase::InternalExecutePrepTest(CommandFlags cmd_flags, TileInde * @param[in,out] cur_company Backup of current company at start of command execution. * @return True if test run can go ahead, false on error. */ -std::tuple CommandHelperBase::InternalExecuteValidateTestAndPrepExec(CommandCost &res, CommandFlags cmd_flags, bool estimate_only, bool network_command, Backup &cur_company) +std::tuple CommandHelperBase::InternalExecuteValidateTestAndPrepExec(CommandCost &res, CommandFlags cmd_flags, bool estimate_only, bool network_command, [[maybe_unused]] Backup &cur_company) { BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE); SetTownRatingTestMode(false); @@ -354,7 +353,7 @@ std::tuple CommandHelperBase::InternalExecuteValidateTestAndPr * @param[in,out] cur_company Backup of current company at start of command execution. * @return Final command result. */ -CommandCost CommandHelperBase::InternalExecuteProcessResult(Commands cmd, CommandFlags cmd_flags, const CommandCost &res_test, const CommandCost &res_exec, Money extra_cash, TileIndex tile, Backup &cur_company) +CommandCost CommandHelperBase::InternalExecuteProcessResult(Commands cmd, CommandFlags cmd_flags, [[maybe_unused]] const CommandCost &res_test, const CommandCost &res_exec, Money extra_cash, TileIndex tile, Backup &cur_company) { BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND); diff --git a/src/command_func.h b/src/command_func.h index d10340146d..35aadb7591 100644 --- a/src/command_func.h +++ b/src/command_func.h @@ -257,7 +257,7 @@ public: protected: /** Helper to process a single ClientID argument. */ template - static inline void SetClientIdHelper(T &data) + static inline void SetClientIdHelper([[maybe_unused]] T &data) { if constexpr (std::is_same_v) { if (data == INVALID_CLIENT_ID) data = CLIENT_ID_SERVER; @@ -333,7 +333,7 @@ protected: /** Helper to process a single ClientID argument. */ template - static inline bool ClientIdIsSet(T &data) + static inline bool ClientIdIsSet([[maybe_unused]] T &data) { if constexpr (std::is_same_v) { return data != INVALID_CLIENT_ID; @@ -350,7 +350,7 @@ protected: } template - static inline Money ExtractAdditionalMoney(Ttuple &values) + static inline Money ExtractAdditionalMoney([[maybe_unused]] Ttuple &values) { if constexpr (std::is_same_v, Money>) { return std::get<1>(values); @@ -359,7 +359,7 @@ protected: } } - static Tret Execute(StringID err_message, CommandCallback *callback, bool my_cmd, bool estimate_only, bool network_command, TileIndex tile, std::tuple args) + static Tret Execute(StringID err_message, CommandCallback *callback, bool, bool estimate_only, bool network_command, TileIndex tile, std::tuple args) { /* Prevent recursion; it gives a mess over the network */ RecursiveCommandCounter counter{}; diff --git a/src/company_gui.cpp b/src/company_gui.cpp index b10c43bdbf..12c377319b 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -396,7 +396,7 @@ struct CompanyFinancesWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_CF_EXPS_CATEGORY: @@ -492,7 +492,7 @@ struct CompanyFinancesWindow : Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_CF_TOGGLE_SIZE: // toggle size @@ -597,7 +597,7 @@ public: return ScaleGUITrad(28) + WidgetDimensions::scaled.hsep_normal + GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal(); } - uint Height(uint width) const override + uint Height(uint) const override { return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal); } @@ -607,7 +607,7 @@ public: return true; } - void Draw(const Rect &r, bool sel, Colours bg_colour) const override + void Draw(const Rect &r, bool sel, Colours) const override { bool rtl = _current_text_dir == TD_RTL; int icon_y = CenterBounds(r.top, r.bottom, 0); @@ -806,7 +806,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SCL_SPACER_DROPDOWN: { @@ -977,7 +977,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { /* Livery Class buttons */ @@ -1082,7 +1082,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -1471,7 +1471,7 @@ public: this->number_dim = number_dim; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SCMF_HAS_MOUSTACHE_EARRING_TEXT: @@ -1647,7 +1647,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { /* Toggle size, advanced/simple face selection */ @@ -1909,7 +1909,7 @@ struct CompanyInfrastructureWindow : Window } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { const Company *c = Company::Get((CompanyID)this->window_number); @@ -2136,7 +2136,7 @@ struct CompanyInfrastructureWindow : Window * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -2359,7 +2359,7 @@ struct CompanyWindow : Window this->DrawWidgets(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_C_FACE: { @@ -2545,7 +2545,7 @@ struct CompanyWindow : Window } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_C_NEW_FACE: DoSelectCompanyManagerFace(this); break; @@ -2641,7 +2641,7 @@ struct CompanyWindow : Window this->SetDirty(); }}; - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { if (Command::Post(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS, tile, OBJECT_HQ, 0) && !_shift_pressed) { ResetObjectToPlace(); @@ -2719,7 +2719,7 @@ struct BuyCompanyWindow : Window { this->company_value = hostile_takeover ? CalculateHostileTakeoverValue(c) : c->bankrupt_value; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BC_FACE: @@ -2764,7 +2764,7 @@ struct BuyCompanyWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BC_NO: diff --git a/src/company_manager_face.h b/src/company_manager_face.h index d7d94a74c4..0cd4805974 100644 --- a/src/company_manager_face.h +++ b/src/company_manager_face.h @@ -93,7 +93,7 @@ static_assert(lengthof(_cmf_info) == CMFV_END); * @pre _cmf_info[cmfv].valid_values[ge] != 0 * @return the requested bits */ -static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge) +static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge) { assert(_cmf_info[cmfv].valid_values[ge] != 0); @@ -108,7 +108,7 @@ static inline uint GetCompanyManagerFaceBits(CompanyManagerFace cmf, CompanyMana * @param val the new value * @pre val < _cmf_info[cmfv].valid_values[ge] */ -static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, GenderEthnicity ge, uint val) +static inline void SetCompanyManagerFaceBits(CompanyManagerFace &cmf, CompanyManagerFaceVariable cmfv, [[maybe_unused]] GenderEthnicity ge, uint val) { assert(val < _cmf_info[cmfv].valid_values[ge]); diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 5c773d573f..eaf2609014 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -86,7 +86,7 @@ public: static ConsoleFileList _console_file_list; ///< File storage cache for the console. /* console command defines */ -#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[]) +#define DEF_CONSOLE_CMD(function) static bool function([[maybe_unused]] byte argc, [[maybe_unused]] char *argv[]) #define DEF_CONSOLE_HOOK(function) static ConsoleHookResult function(bool echo) diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 047f8a1780..82f70210a4 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -200,7 +200,7 @@ struct IConsoleWindow : Window if (_iconsole_cmdline.HandleCaret()) this->SetDirty(); } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { if (_focused_window != this) return ES_NOT_HANDLED; @@ -271,7 +271,7 @@ struct IConsoleWindow : Window return ES_HANDLED; } - void InsertTextString(int wid, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) override + void InsertTextString(int, const char *str, bool marked, const char *caret, const char *insert_location, const char *replacement_end) override { if (_iconsole_cmdline.InsertString(str, marked, caret, insert_location, replacement_end)) { IConsoleWindow::scroll = 0; @@ -323,7 +323,7 @@ struct IConsoleWindow : Window VideoDriver::GetInstance()->EditBoxGainedFocus(); } - void OnFocusLost(bool closing) override + void OnFocusLost(bool) override { VideoDriver::GetInstance()->EditBoxLostFocus(); } diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp index 63278c8d17..11190bdc00 100644 --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -275,13 +275,12 @@ struct Pool : PoolBase { /** * Allocates space for new Titem at given memory address - * @param size size of Titem * @param ptr where are we allocating the item? * @return pointer to allocated memory (== ptr) * @note use of this is strongly discouraged * @pre the memory must not be allocated in the Pool! */ - inline void *operator new(size_t size, void *ptr) + inline void *operator new(size_t, void *ptr) { for (size_t i = 0; i < Tpool->first_unused; i++) { /* Don't allow creating new objects over existing. @@ -375,7 +374,7 @@ struct Pool : PoolBase { * @note when this function is called, PoolItem::Get(index) == nullptr. * @note it's called only when !CleaningPool() */ - static inline void PostDestructor(size_t index) { } + static inline void PostDestructor([[maybe_unused]] size_t index) { } /** * Returns an iterable ensemble of all valid Titem diff --git a/src/cpu.cpp b/src/cpu.cpp index 7de424e3d8..239c0e2347 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -155,7 +155,7 @@ void ottd_cpuid(int info[4], int type) } } #else -void ottd_cpuid(int info[4], int type) +void ottd_cpuid(int info[4], int) { info[0] = info[1] = info[2] = info[3] = 0; } diff --git a/src/date_gui.cpp b/src/date_gui.cpp index 9d94e154da..cb111f50ab 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -55,7 +55,7 @@ struct SetDateWindow : Window { this->date.year = Clamp(this->date.year, min_year, max_year); } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = { this->parent->left + this->parent->width / 2 - sm_width / 2, this->parent->top + this->parent->height / 2 - sm_height / 2 }; return pt; @@ -99,7 +99,7 @@ struct SetDateWindow : Window { ShowDropDownList(this, std::move(list), selected, widget); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { Dimension d = {0, 0}; switch (widget) { @@ -137,7 +137,7 @@ struct SetDateWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SD_DAY: diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 28d5d6ea11..4ed3df4bde 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -117,11 +117,10 @@ extern void DepotSortList(VehicleList *list); /** * This is the Callback method after the cloning attempt of a vehicle - * @param cmd unused * @param result the result of the cloning command * @param veh_id cloned vehicle ID */ -void CcCloneVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id) +void CcCloneVehicle(Commands, const CommandCost &result, VehicleID veh_id) { if (result.Failed()) return; @@ -656,7 +655,7 @@ struct DepotWindow : Window { this->flag_size = maxdim(GetScaledSpriteSize(SPR_FLAG_VEH_STOPPED), GetScaledSpriteSize(SPR_FLAG_VEH_RUNNING)); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_D_MATRIX: { @@ -704,7 +703,7 @@ struct DepotWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { this->generate_list = true; } @@ -760,7 +759,7 @@ struct DepotWindow : Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_D_MATRIX: // List @@ -842,7 +841,7 @@ struct DepotWindow : Window { Command::Post(STR_ERROR_CAN_T_RENAME_DEPOT, this->GetDepotIndex(), str); } - bool OnRightClick(Point pt, int widget) override + bool OnRightClick([[maybe_unused]] Point pt, int widget) override { if (widget != WID_D_MATRIX) return false; diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp index 4aa5549c83..fed432fdc4 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -690,7 +690,7 @@ static bool DisasterTick_Submarine(DisasterVehicle *v) } -static bool DisasterTick_NULL(DisasterVehicle *v) +static bool DisasterTick_NULL(DisasterVehicle *) { return true; } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index ee3446e7ba..9c0d9b61d9 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -45,7 +45,7 @@ static void ShowBuildDocksDepotPicker(Window *parent); static Axis _ship_depot_direction; -void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile) +void CcBuildDocks(Commands, const CommandCost &result, TileIndex tile) { if (result.Failed()) return; @@ -53,7 +53,7 @@ void CcBuildDocks(Commands cmd, const CommandCost &result, TileIndex tile) if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } -void CcPlaySound_CONSTRUCTION_WATER(Commands cmd, const CommandCost &result, TileIndex tile) +void CcPlaySound_CONSTRUCTION_WATER(Commands, const CommandCost &result, TileIndex tile) { if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_CONSTRUCTION_WATER, tile); } @@ -120,7 +120,7 @@ struct BuildDocksToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -148,7 +148,7 @@ struct BuildDocksToolbarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_DT_CANAL: // Build canal button @@ -189,7 +189,7 @@ struct BuildDocksToolbarWindow : Window { this->last_clicked_widget = (DockToolbarWidgets)widget; } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (this->last_clicked_widget) { case WID_DT_CANAL: // Build canal button @@ -242,12 +242,12 @@ struct BuildDocksToolbarWindow : Window { } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -278,7 +278,7 @@ struct BuildDocksToolbarWindow : Window { CloseWindowByClass(WC_BUILD_BRIDGE); } - void OnPlacePresize(Point pt, TileIndex tile_from) override + void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile_from) override { TileIndex tile_to = tile_from; @@ -453,7 +453,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case BDSW_LT_OFF: @@ -468,7 +468,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -525,7 +525,7 @@ public: UpdateDocksDirection(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BDD_X: @@ -559,7 +559,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BDD_X: diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index ea580ffe31..3d1cf12781 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -77,7 +77,7 @@ struct EnginePreviewWindow : Window { this->flags |= WF_STICKY; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_EP_QUESTION) return; @@ -122,7 +122,7 @@ struct EnginePreviewWindow : Window { DrawStringMultiLine(r.left, r.right, y, r.bottom, GetEngineInfoString(engine), TC_FROMSTRING, SA_CENTER); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_EP_YES: @@ -134,7 +134,7 @@ struct EnginePreviewWindow : Window { } } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; diff --git a/src/error_gui.cpp b/src/error_gui.cpp index 2aacc1eed8..94ac9c7461 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -188,7 +188,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_EM_MESSAGE: { @@ -217,7 +217,7 @@ public: } } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { /* Position (0, 0) given, center the window. */ if (this->position.x == 0 && this->position.y == 0) { @@ -253,7 +253,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { /* If company gets shut down, while displaying an error about it, remove the error message. */ if (this->face != INVALID_COMPANY && !Company::IsValidID(this->face)) this->Close(); diff --git a/src/fileio.cpp b/src/fileio.cpp index 7e69db0316..e090820e3c 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -474,7 +474,7 @@ static std::string ExtractString(char *buffer, size_t buffer_length) return StrMakeValid(std::string(buffer, length)); } -bool TarScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) +bool TarScanner::AddFile(const std::string &filename, size_t, [[maybe_unused]] const std::string &tar_filename) { /* No tar within tar. */ assert(tar_filename.empty()); diff --git a/src/fios.cpp b/src/fios.cpp index c2becb25f1..8e150daafd 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -275,10 +275,9 @@ public: /** * Try to add a fios item set with the given filename. * @param filename the full path to the file to read - * @param basepath_length amount of characters to chop of before to get a relative filename * @return true if the file is added. */ -bool FiosFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) +bool FiosFileScanner::AddFile(const std::string &filename, size_t, const std::string &) { auto sep = filename.rfind('.'); if (sep == std::string::npos) return false; @@ -531,7 +530,7 @@ void FiosGetScenarioList(SaveLoadOperation fop, FileList &file_list) FiosGetFileList(fop, &FiosGetScenarioListCallback, subdir, file_list); } -static std::tuple FiosGetHeightmapListCallback(SaveLoadOperation fop, const std::string &file, const std::string_view ext) +static std::tuple FiosGetHeightmapListCallback(SaveLoadOperation, const std::string &file, const std::string_view ext) { /* Show heightmap files * .PNG PNG Based heightmap files @@ -640,7 +639,7 @@ public: this->scanned = true; } - bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override + bool AddFile(const std::string &filename, size_t, const std::string &) override { FILE *f = FioFOpenFile(filename, "r", SCENARIO_DIR); if (f == nullptr) return false; @@ -729,7 +728,7 @@ FiosNumberedSaveName::FiosNumberedSaveName(const std::string &prefix) : prefix(p static std::string _prefix; ///< Static as the lambda needs access to it. /* Callback for FiosFileScanner. */ - static FiosGetTypeAndNameProc *proc = [](SaveLoadOperation fop, const std::string &file, const std::string_view ext) { + static FiosGetTypeAndNameProc *proc = [](SaveLoadOperation, const std::string &file, const std::string_view ext) { if (StrEqualsIgnoreCase(ext, ".sav") && StrStartsWith(file, _prefix)) return std::tuple(FIOS_TYPE_FILE, std::string{}); return std::tuple(FIOS_TYPE_INVALID, std::string{}); }; diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 8eb5c7255a..9b7820edcf 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -282,13 +282,13 @@ private: QueryString filter_editbox; ///< Filter editbox; std::vector display_list; ///< Filtered display list - static void SaveGameConfirmationCallback(Window *w, bool confirmed) + static void SaveGameConfirmationCallback(Window *, bool confirmed) { /* File name has already been written to _file_to_saveload */ if (confirmed) _switch_mode = SM_SAVE_GAME; } - static void SaveHeightmapConfirmationCallback(Window *w, bool confirmed) + static void SaveHeightmapConfirmationCallback(Window *, bool confirmed) { /* File name has already been written to _file_to_saveload */ if (confirmed) _switch_mode = SM_SAVE_HEIGHTMAP; @@ -561,7 +561,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SL_BACKGROUND: @@ -594,7 +594,7 @@ public: this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SL_SORT_BYNAME: // Sort save names by name @@ -716,7 +716,7 @@ public: } } - void OnMouseOver(Point pt, int widget) override + void OnMouseOver([[maybe_unused]] Point pt, int widget) override { if (widget == WID_SL_DRIVES_DIRECTORIES_LIST) { auto it = this->vscroll->GetScrolledItemFromWidget(this->display_list, pt.y, this, WID_SL_DRIVES_DIRECTORIES_LIST, WidgetDimensions::scaled.inset.top); @@ -735,7 +735,7 @@ public: } } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { if (keycode == WKC_ESC) { this->Close(); diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 096d5eddde..ce5dffe6a4 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -204,5 +204,5 @@ bool HasAntialiasedFonts() #if !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int winlangid, MissingGlyphSearcher *callback) { return false; } +bool SetFallbackFont(FontCacheSettings *, const std::string &, int, MissingGlyphSearcher *) { return false; } #endif /* !defined(_WIN32) && !defined(__APPLE__) && !defined(WITH_FONTCONFIG) && !defined(WITH_COCOA) */ diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index 19da21bbe5..bb6f282d0e 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -63,7 +63,7 @@ FreeTypeFontCache::FreeTypeFontCache(FontSize fs, FT_Face face, int pixels) : Tr this->SetFontSize(fs, face, pixels); } -void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels) +void FreeTypeFontCache::SetFontSize(FontSize, FT_Face, int pixels) { if (pixels == 0) { /* Try to determine a good height based on the minimal height recommended by the font. */ diff --git a/src/fontcache/spritefontcache.h b/src/fontcache/spritefontcache.h index 6693119f06..4e710c1a93 100644 --- a/src/fontcache/spritefontcache.h +++ b/src/fontcache/spritefontcache.h @@ -30,7 +30,7 @@ public: virtual uint GetGlyphWidth(GlyphID key); virtual bool GetDrawGlyphShadow(); virtual GlyphID MapCharToGlyph(char32_t key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } - virtual const void *GetFontTable(uint32_t tag, size_t &length) { length = 0; return nullptr; } + const void *GetFontTable(uint32_t, size_t &length) override { length = 0; return nullptr; } virtual std::string GetFontName() { return "sprite"; } virtual bool IsBuiltInFont() { return true; } }; diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 453d9f142f..40fbaf387c 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -460,7 +460,7 @@ struct FramerateWindow : Window { ResizeWindow(this, 0, (std::max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL); } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { /* Check if the shaded state has changed, switch caption text if it has */ if (this->small != this->IsShaded()) { @@ -540,7 +540,7 @@ struct FramerateWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_FRW_RATE_GAMELOOP: @@ -693,7 +693,7 @@ struct FramerateWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_FRW_TIMES_NAMES: @@ -780,7 +780,7 @@ struct FrametimeGraphWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_FGW_GRAPH) { SetDParam(0, 100); @@ -883,7 +883,7 @@ struct FrametimeGraphWindow : Window { this->UpdateScale(); }}; - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { this->SetDirty(); } diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index 6a1c89596d..e2142da061 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -130,7 +130,7 @@ struct GSConfigWindow : public Window { this->vscroll->SetCount(this->visible_settings.size()); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_GSC_SETTINGS: @@ -238,7 +238,7 @@ struct GSConfigWindow : public Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_GSC_TEXTFILE && widget < WID_GSC_TEXTFILE + TFT_CONTENT_END) { if (GameConfig::GetConfig() == nullptr) return; @@ -371,7 +371,7 @@ struct GSConfigWindow : public Window { SetValue(index); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. @@ -398,7 +398,7 @@ struct GSConfigWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 34feb8f119..7c9b900a6d 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -121,7 +121,7 @@ struct TranslationWriter : LanguageWriter { { } - void WriteHeader(const LanguagePackHeader *header) + void WriteHeader(const LanguagePackHeader *) { /* We don't use the header. */ } @@ -131,7 +131,7 @@ struct TranslationWriter : LanguageWriter { /* Nothing to do. */ } - void WriteLength(uint length) + void WriteLength(uint) { /* We don't write the length. */ } @@ -159,7 +159,7 @@ struct StringNameWriter : HeaderWriter { if (stringid == (int)this->strings.size()) this->strings.emplace_back(name); } - void Finalise(const StringData &data) + void Finalise(const StringData &) { /* Nothing to do. */ } @@ -185,7 +185,7 @@ public: this->FileScanner::Scan(".txt", directory, false); } - bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) override + bool AddFile(const std::string &filename, size_t, const std::string &) override { if (exclude == filename) return true; diff --git a/src/gamelog.cpp b/src/gamelog.cpp index a0e7d63bff..6ed62159df 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -168,13 +168,13 @@ void Gamelog::Print(std::function proc) } -/* virtual */ void LoggedChangeMode::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeMode::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &, GamelogActionType) { /* Changing landscape, or going from scenario editor to game or back. */ fmt::format_to(output_iterator, "New game mode: {} landscape: {}", this->mode, this->landscape); } -/* virtual */ void LoggedChangeRevision::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeRevision::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &, GamelogActionType) { /* The game was loaded in a diffferent version than before. */ fmt::format_to(output_iterator, "Revision text changed to {}, savegame version {}, ", @@ -189,7 +189,7 @@ void Gamelog::Print(std::function proc) fmt::format_to(output_iterator, "modified, _openttd_newgrf_version = 0x{:08x}", this->newgrf); } -/* virtual */ void LoggedChangeOldVersion::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeOldVersion::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &, GamelogActionType) { /* The game was loaded from before 0.7.0-beta1. */ fmt::format_to(output_iterator, "Conversion from "); @@ -221,13 +221,13 @@ void Gamelog::Print(std::function proc) } } -/* virtual */ void LoggedChangeSettingChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeSettingChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &, GamelogActionType) { /* A setting with the SF_NO_NETWORK flag got changed; these settings usually affect NewGRFs, such as road side or wagon speed limits. */ fmt::format_to(output_iterator, "Setting changed: {} : {} -> {}", this->name, this->oldval, this->newval); } -/* virtual */ void LoggedChangeGRFAdd::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeGRFAdd::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType) { /* A NewGRF got added to the game, either at the start of the game (never an issue), or later on when it could be an issue. */ const GRFConfig *gc = FindGRFConfig(this->grfid, FGCM_EXACT, &this->md5sum); @@ -256,7 +256,7 @@ void Gamelog::Print(std::function proc) } } -/* virtual */ void LoggedChangeGRFChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeGRFChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType) { /* Another version of the same NewGRF got loaded. */ const GRFConfig *gc = FindGRFConfig(this->grfid, FGCM_EXACT, &this->md5sum); @@ -266,7 +266,7 @@ void Gamelog::Print(std::function proc) grf_names[this->grfid] = gc; } -/* virtual */ void LoggedChangeGRFParameterChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeGRFParameterChanged::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType) { /* A parameter of a NewGRF got changed after the game was started. */ auto gm = grf_names.find(this->grfid); @@ -275,7 +275,7 @@ void Gamelog::Print(std::function proc) if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!"); } -/* virtual */ void LoggedChangeGRFMoved::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeGRFMoved::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType) { /* The order of NewGRFs got changed, which might cause some other NewGRFs to behave differently. */ auto gm = grf_names.find(this->grfid); @@ -285,7 +285,7 @@ void Gamelog::Print(std::function proc) if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!"); } -/* virtual */ void LoggedChangeGRFBug::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeGRFBug::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType) { /* A specific bug in a NewGRF, that could cause wide spread problems, has been noted during the execution of the game. */ auto gm = grf_names.find(this->grfid); @@ -296,7 +296,7 @@ void Gamelog::Print(std::function proc) if (gm == grf_names.end()) fmt::format_to(output_iterator, ". Gamelog inconsistency: GrfID was never added!"); } -/* virtual */ void LoggedChangeEmergencySave::FormatTo(std::back_insert_iterator &output_iterator, GrfIDMapping &grf_names, GamelogActionType action_type) +/* virtual */ void LoggedChangeEmergencySave::FormatTo(std::back_insert_iterator &, GrfIDMapping &, GamelogActionType) { /* At one point the savegame was made during the handling of a game crash. * The generic code already mentioned the emergency savegame, and there is no extra information to log. */ diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index 5dbd1c59b0..8c2ebefb00 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -520,7 +520,7 @@ struct GenerateLandscapeWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* Update the climate buttons */ @@ -588,7 +588,7 @@ struct GenerateLandscapeWindow : public Window { } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { Dimension d{0, (uint)FONT_HEIGHT_NORMAL}; const StringID *strs = nullptr; @@ -681,7 +681,7 @@ struct GenerateLandscapeWindow : public Window { *size = maxdim(*size, d); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GL_TEMPERATE: @@ -1132,7 +1132,7 @@ struct CreateScenarioWindow : public Window this->DrawWidgets(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { StringID str = STR_JUST_INT; switch (widget) { @@ -1159,7 +1159,7 @@ struct CreateScenarioWindow : public Window *size = maxdim(*size, d); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_CS_TEMPERATE: @@ -1372,7 +1372,7 @@ static const StringID _generation_class_table[] = { static_assert(lengthof(_generation_class_table) == GWP_CLASS_COUNT); -static void AbortGeneratingWorldCallback(Window *w, bool confirmed) +static void AbortGeneratingWorldCallback(Window *, bool confirmed) { if (confirmed) { AbortGeneratingWorld(); @@ -1388,7 +1388,7 @@ struct GenerateProgressWindow : public Window { this->InitNested(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GP_ABORT: @@ -1403,7 +1403,7 @@ struct GenerateProgressWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_GP_PROGRESS_BAR: { diff --git a/src/gfx_layout_fallback.cpp b/src/gfx_layout_fallback.cpp index 7982317e63..1b3d020ac4 100644 --- a/src/gfx_layout_fallback.cpp +++ b/src/gfx_layout_fallback.cpp @@ -65,7 +65,7 @@ public: int CountRuns() const override; const ParagraphLayouter::VisualRun &GetVisualRun(int run) const override; - int GetInternalCharLength(char32_t c) const override { return 1; } + int GetInternalCharLength(char32_t) const override { return 1; } }; const char32_t *buffer_begin; ///< Begin of the buffer. @@ -265,7 +265,7 @@ const ParagraphLayouter::VisualRun &FallbackParagraphLayout::FallbackLine::GetVi * @param length The length of the paragraph. * @param runs The font mapping of this paragraph. */ -FallbackParagraphLayout::FallbackParagraphLayout(char32_t *buffer, int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs) +FallbackParagraphLayout::FallbackParagraphLayout(char32_t *buffer, [[maybe_unused]] int length, FontMap &runs) : buffer_begin(buffer), buffer(buffer), runs(runs) { assert(runs.rbegin()->first == length); } diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index 9ff4a32738..f1e30b6205 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -63,7 +63,7 @@ struct GoalListWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GOAL_GLOBAL_BUTTON: @@ -168,7 +168,7 @@ struct GoalListWindow : public Window { return num; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_GOAL_LIST) return; Dimension d = GetStringBoundingBox(STR_GOALS_NONE); @@ -269,7 +269,7 @@ struct GoalListWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->vscroll->SetCount(this->CountLines()); @@ -370,7 +370,7 @@ struct GoalQuestionWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GQ_BUTTON_1: @@ -390,7 +390,7 @@ struct GoalQuestionWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_GQ_QUESTION) return; diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp index 57f1e80949..c17a916233 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -76,7 +76,7 @@ struct GraphLegendWindow : Window { DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), STR_COMPANY_NAME_COMPANY_NUM, HasBit(_legend_excluded_companies, cid) ? TC_BLACK : TC_WHITE); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (!IsInsideMM(widget, WID_GL_FIRST_COMPANY, MAX_COMPANIES + WID_GL_FIRST_COMPANY)) return; @@ -95,7 +95,7 @@ struct GraphLegendWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (Company::IsValidID(data)) return; @@ -493,7 +493,7 @@ protected: } public: - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != this->graph_widget) return; @@ -536,12 +536,12 @@ public: DrawGraph(r); } - virtual OverflowSafeInt64 GetGraphData(const Company *c, int j) + virtual OverflowSafeInt64 GetGraphData(const Company *, int) { return INVALID_DATAPOINT; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { /* Clicked on legend? */ if (widget == WID_CV_KEY_BUTTON) ShowGraphLegend(); @@ -557,7 +557,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->UpdateStatistics(true); @@ -782,7 +782,7 @@ struct PerformanceHistoryGraphWindow : BaseGraphWindow { return c->old_economy[j].performance_history; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget == WID_PHG_DETAILED_PERFORMANCE) ShowPerformanceRatingDetail(); this->BaseGraphWindow::OnClick(pt, widget, click_count); @@ -916,7 +916,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_CPR_MATRIX) { BaseGraphWindow::UpdateWidgetSize(widget, size, padding, fill, resize); @@ -975,7 +975,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_CPR_ENABLE_CARGOES: @@ -1025,7 +1025,7 @@ struct PaymentRatesGraphWindow : BaseGraphWindow { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->UpdatePaymentRates(); @@ -1142,7 +1142,7 @@ struct PerformanceRatingDetailWindow : Window { uint score_detail_left; uint score_detail_right; - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_PRD_SCORE_FIRST: @@ -1279,7 +1279,7 @@ struct PerformanceRatingDetailWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { /* Check which button is clicked */ if (IsInsideMM(widget, WID_PRD_COMPANY_FIRST, WID_PRD_COMPANY_LAST + 1)) { @@ -1307,7 +1307,7 @@ struct PerformanceRatingDetailWindow : Window { * @param data the company ID of the company that is going to be removed * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* Disable the companies who are not active */ diff --git a/src/group_gui.cpp b/src/group_gui.cpp index cc7992497c..c52153fe2f 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -384,7 +384,7 @@ public: *this->sorting = this->vehgroups.GetListing(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_GL_LIST_GROUP: @@ -442,7 +442,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -651,7 +651,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GL_SORT_BY_ORDER: // Flip sorting method ascending/descending @@ -1169,14 +1169,12 @@ static void CcCreateGroup(GroupID gid, VehicleType veh_type) /** * Opens a 'Rename group' window for newly created group. - * @param cmd Unused. * @param result Did command succeed? * @param new_group ID of the created group. * @param vt Vehicle type. - * @param parent_group Parent group of the new group. * @see CmdCreateGroup */ -void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID parent_group) +void CcCreateGroup(Commands, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID) { if (result.Failed()) return; @@ -1186,12 +1184,10 @@ void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, V /** * Open rename window after adding a vehicle to a new group via drag and drop. - * @param cmd Unused. * @param result Did command succeed? * @param new_group ID of the created group. - * @param veh_id vehicle to add to a group */ -void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID new_group, GroupID, VehicleID veh_id, bool, const VehicleListIdentifier &) +void CcAddVehicleNewGroup(Commands, const CommandCost &result, GroupID new_group, GroupID, VehicleID, bool, const VehicleListIdentifier &) { if (result.Failed()) return; diff --git a/src/help_gui.cpp b/src/help_gui.cpp index d575725cdb..5c052af917 100644 --- a/src/help_gui.cpp +++ b/src/help_gui.cpp @@ -129,7 +129,7 @@ struct HelpWindow : public Window { this->EnableTextfileButton(LICENSE_FILENAME, WID_HW_LICENSE); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_HW_README: diff --git a/src/highscore_gui.cpp b/src/highscore_gui.cpp index 4b55d65586..7989b6071f 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -65,12 +65,12 @@ struct EndGameHighScoreBaseWindow : Window { return pt; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, [[maybe_unused]] int widget, [[maybe_unused]] int click_count) override { this->Close(); } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { /* All keys are 'handled' by this window but we want to make * sure that 'quit' still works correctly. Not handling the diff --git a/src/hotkeys.cpp b/src/hotkeys.cpp index d1374e86e1..478d2ca233 100644 --- a/src/hotkeys.cpp +++ b/src/hotkeys.cpp @@ -348,7 +348,7 @@ void SaveHotkeysToConfig() SaveLoadHotkeys(true); } -void HandleGlobalHotkeys(char32_t key, uint16_t keycode) +void HandleGlobalHotkeys([[maybe_unused]] char32_t key, uint16_t keycode) { for (HotkeyList *list : *_hotkey_lists) { if (list->global_hotkey_handler == nullptr) continue; diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 6d5f17e6ac..64d69988db 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -206,7 +206,7 @@ Industry::~Industry() * Invalidating some stuff after removing item from the pool. * @param index index of deleted item */ -void Industry::PostDestructor(size_t index) +void Industry::PostDestructor(size_t) { InvalidateWindowData(WC_INDUSTRY_DIRECTORY, 0, IDIWD_FORCE_REBUILD); SetWindowDirty(WC_BUILD_INDUSTRY, 0); @@ -385,7 +385,7 @@ static void DrawTile_Industry(TileInfo *ti) } } -static int GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Industry(TileIndex tile, uint, uint, bool) { return GetTileMaxPixelZ(tile); } @@ -952,7 +952,7 @@ static bool ClickTile_Industry(TileIndex tile) return true; } -static TrackStatus GetTileTrackStatus_Industry(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Industry(TileIndex, TransportType, uint, DiagDirection) { return 0; } @@ -1094,10 +1094,9 @@ void PlantRandomFarmField(const Industry *i) /** * Search callback function for ChopLumberMillTrees * @param tile to test - * @param user_data that is passed by the caller. In this case, nothing * @return the result of the test */ -static bool SearchLumberMillTrees(TileIndex tile, void *user_data) +static bool SearchLumberMillTrees(TileIndex tile, void *) { if (IsTileType(tile, MP_TREES) && GetTreeGrowth(tile) > 2) { ///< 3 and up means all fully grown trees /* found a tree */ @@ -1225,10 +1224,9 @@ void OnTick_Industry() /** * Check the conditions of #CHECK_NOTHING (Always succeeds). - * @param tile %Tile to perform the checking. * @return Succeeded or failed command. */ -static CommandCost CheckNewIndustry_NULL(TileIndex tile) +static CommandCost CheckNewIndustry_NULL(TileIndex) { return CommandCost(); } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 354041b37a..8526a95c8b 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -243,12 +243,11 @@ void SortIndustryTypes() /** * Command callback. In case of failure to build an industry, show an error message. - * @param cmd Unused. * @param result Result of the command. * @param tile Tile where the industry is placed. * @param indtype Industry type. */ -void CcBuildIndustry(Commands cmd, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t) +void CcBuildIndustry(Commands, const CommandCost &result, TileIndex tile, IndustryType indtype, uint32_t, bool, uint32_t) { if (result.Succeeded()) return; @@ -425,7 +424,7 @@ public: this->SetupArrays(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_DPI_MATRIX_WIDGET: { @@ -598,7 +597,7 @@ public: } } - static void AskManyRandomIndustriesCallback(Window *w, bool confirmed) + static void AskManyRandomIndustriesCallback(Window *, bool confirmed) { if (!confirmed) return; @@ -613,7 +612,7 @@ public: } } - static void AskRemoveAllIndustriesCallback(Window *w, bool confirmed) + static void AskRemoveAllIndustriesCallback(Window *, bool confirmed) { if (!confirmed) return; @@ -629,7 +628,7 @@ public: MarkWholeScreenDirty(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_DPI_CREATE_RANDOM_INDUSTRIES_WIDGET: { @@ -693,7 +692,7 @@ public: this->vscroll->SetCapacityFromWidget(this, WID_DPI_MATRIX_WIDGET); } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { bool success = true; /* We do not need to protect ourselves against "Random Many Industries" in this mode */ @@ -753,7 +752,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->SetupArrays(); @@ -989,12 +988,12 @@ public: if (widget == WID_IV_CAPTION) SetDParam(0, this->window_number); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_IV_INFO) size->height = this->info_height; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_IV_INFO: { @@ -1142,7 +1141,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; const Industry *i = Industry::Get(this->window_number); @@ -1617,7 +1616,7 @@ protected: } public: - IndustryDirectoryWindow(WindowDesc *desc, WindowNumber number) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH) + IndustryDirectoryWindow(WindowDesc *desc, WindowNumber) : Window(desc), industry_editbox(MAX_FILTER_LENGTH * MAX_CHAR_LENGTH, MAX_FILTER_LENGTH) { this->CreateNestedTree(); this->vscroll = this->GetScrollbar(WID_ID_SCROLLBAR); @@ -1694,7 +1693,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_ID_DROPDOWN_ORDER: { @@ -1732,7 +1731,7 @@ public: } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_ID_DROPDOWN_ORDER: @@ -1821,7 +1820,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { switch (data) { case IDIWD_FORCE_REBUILD: @@ -2586,7 +2585,7 @@ struct IndustryCargoesWindow : public Window { CargoesField::cargo_field_width = CargoesField::cargo_border.width * 2 + CargoesField::cargo_line.width * CargoesField::max_cargoes + CargoesField::cargo_space.width * (CargoesField::max_cargoes - 1); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_IC_PANEL: @@ -2924,7 +2923,7 @@ struct IndustryCargoesWindow : public Window { * - data = NUM_INDUSTRYTYPES: Stop sending updates to the smallmap window. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (data == NUM_INDUSTRYTYPES) { @@ -3021,7 +3020,7 @@ struct IndustryCargoesWindow : public Window { return true; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_IC_PANEL: { @@ -3108,7 +3107,7 @@ struct IndustryCargoesWindow : public Window { } } - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override + bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override { if (widget != WID_IC_PANEL) return false; diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 9ba6dc6b61..4f8dd95db2 100644 --- a/src/intro_gui.cpp +++ b/src/intro_gui.cpp @@ -190,7 +190,7 @@ struct SelectGameWindow : public Window { this->mouse_idle_pos = _cursor.pos; } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { /* Move the main game viewport according to intro viewport commands. */ @@ -264,7 +264,7 @@ struct SelectGameWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetLoweredState(WID_SGI_TEMPERATE_LANDSCAPE, _settings_newgame.game_creation.landscape == LT_TEMPERATE); @@ -297,7 +297,7 @@ struct SelectGameWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { StringID str = 0; switch (widget) { @@ -326,7 +326,7 @@ struct SelectGameWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { /* Do not create a network server when you (just) have closed one of the game * creation/load windows for the network server. */ @@ -507,7 +507,7 @@ void ShowSelectGameWindow() new SelectGameWindow(&_select_game_desc); } -static void AskExitGameCallback(Window *w, bool confirmed) +static void AskExitGameCallback(Window *, bool confirmed) { if (confirmed) { _survey.Transmit(NetworkSurveyHandler::Reason::EXIT, true); @@ -527,7 +527,7 @@ void AskExitGame() } -static void AskExitToGameMenuCallback(Window *w, bool confirmed) +static void AskExitToGameMenuCallback(Window *, bool confirmed) { if (confirmed) { _switch_mode = SM_MENU; diff --git a/src/landscape.cpp b/src/landscape.cpp index 036402bfd1..87c2c73943 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -978,10 +978,9 @@ static void CreateDesertOrRainForest(uint desert_tropic_line) /** * Find the spring of a river. * @param tile The tile to consider for being the spring. - * @param user_data Ignored data. * @return True iff it is suitable as a spring. */ -static bool FindSpring(TileIndex tile, void *user_data) +static bool FindSpring(TileIndex tile, void *) { int referenceHeight; if (!IsTileFlat(tile, &referenceHeight) || IsWaterTile(tile)) return false; @@ -1216,13 +1215,13 @@ static int32_t River_EndNodeCheck(const AyStar *aystar, const OpenListNode *curr } /* AyStar callback for getting the cost of the current node. */ -static int32_t River_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent) +static int32_t River_CalculateG(AyStar *, AyStarNode *, OpenListNode *) { return 1 + RandomRange(_settings_game.game_creation.river_route_random); } /* AyStar callback for getting the estimated cost to the destination. */ -static int32_t River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent) +static int32_t River_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *) { return DistanceManhattan(*(TileIndex*)aystar->user_target, current->tile); } @@ -1283,10 +1282,9 @@ static const uint RIVER_HASH_SIZE = 8; ///< The number of bits the hash for rive /** * Simple hash function for river tiles to be used by AyStar. * @param tile The tile to hash. - * @param dir The unused direction. * @return The hash for the tile. */ -static uint River_Hash(TileIndex tile, Trackdir dir) +static uint River_Hash(TileIndex tile, Trackdir) { return GB(TileHash(TileX(tile), TileY(tile)), 0, RIVER_HASH_SIZE); } diff --git a/src/league_gui.cpp b/src/league_gui.cpp index f97a041604..8775695b16 100644 --- a/src/league_gui.cpp +++ b/src/league_gui.cpp @@ -127,7 +127,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_PLT_BACKGROUND) return; @@ -175,7 +175,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -354,7 +354,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_SLT_BACKGROUND) return; @@ -394,7 +394,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget != WID_SLT_BACKGROUND) return; @@ -411,7 +411,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { this->BuildTable(); this->ReInit(); diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index bcd3325075..e284a156be 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -580,7 +580,7 @@ void LinkGraphLegendWindow::SetOverlay(std::shared_ptr overlay } } -void LinkGraphLegendWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) +void LinkGraphLegendWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) { if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) { StringID str = STR_NULL; @@ -639,7 +639,7 @@ void LinkGraphLegendWindow::DrawWidget(const Rect &r, int widget) const } } -bool LinkGraphLegendWindow::OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) +bool LinkGraphLegendWindow::OnTooltip([[maybe_unused]] Point, int widget, TooltipCloseCondition close_cond) { if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) { if (this->IsWidgetDisabled(widget)) { @@ -686,7 +686,7 @@ void LinkGraphLegendWindow::UpdateOverlayCargoes() this->overlay->SetCargoMask(mask); } -void LinkGraphLegendWindow::OnClick(Point pt, int widget, int click_count) +void LinkGraphLegendWindow::OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) { /* Check which button is clicked */ if (IsInsideMM(widget, WID_LGL_COMPANY_FIRST, WID_LGL_COMPANY_LAST + 1)) { @@ -718,7 +718,7 @@ void LinkGraphLegendWindow::OnClick(Point pt, int widget, int click_count) * @param data ignored * @param gui_scope ignored */ -void LinkGraphLegendWindow::OnInvalidateData(int data, bool gui_scope) +void LinkGraphLegendWindow::OnInvalidateData([[maybe_unused]] int data, [[maybe_unused]] bool gui_scope) { if (this->num_cargo != _sorted_cargo_specs.size()) { this->Close(); diff --git a/src/linkgraph/linkgraph_gui.h b/src/linkgraph/linkgraph_gui.h index 17b4731136..db2300e8f7 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -108,10 +108,10 @@ public: LinkGraphLegendWindow(WindowDesc *desc, int window_number); void SetOverlay(std::shared_ptr overlay); - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override; + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override; void DrawWidget(const Rect &r, int widget) const override; - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override; - void OnClick(Point pt, int widget, int click_count) override; + bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override; + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override; void OnInvalidateData(int data = 0, bool gui_scope = true) override; private: diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp index 051d50924e..b6160f22f4 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -108,10 +108,9 @@ public: /** * Setup the node to start iterating at. - * @param source Unused. * @param node Node to start iterating at. */ - void SetNode(NodeID source, NodeID node) + void SetNode(NodeID, NodeID node) { this->i = this->job[node].edges.cbegin(); this->end = this->job[node].edges.cend(); @@ -197,7 +196,7 @@ public: * @return True if base + the new edge would be better than the path associated * with this annotation. */ -bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint cap, +bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint, int free_cap, uint dist) const { /* If any of the paths is disconnected, the other one is better. If both diff --git a/src/main_gui.cpp b/src/main_gui.cpp index d27976bbcc..36578e4672 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -78,7 +78,7 @@ bool HandlePlacePushButton(Window *w, int widget, CursorID cursor, HighLightStyl } -void CcPlaySound_EXPLOSION(Commands cmd, const CommandCost &result, TileIndex tile) +void CcPlaySound_EXPLOSION(Commands, const CommandCost &result, TileIndex tile) { if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_12_EXPLOSION, tile); } @@ -443,7 +443,7 @@ struct MainWindow : Window } } - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override + bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override { if (widget != WID_M_VIEWPORT) return false; return this->viewport->overlay->ShowTooltip(pt, close_cond); @@ -454,7 +454,7 @@ struct MainWindow : Window * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* Forward the message to the appropriate toolbar (ingame or scenario editor) */ diff --git a/src/misc_cmd.cpp b/src/misc_cmd.cpp index 7b3553810a..aa2f4d6029 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -121,10 +121,9 @@ CommandCost CmdDecreaseLoan(DoCommandFlag flags, LoanCommand cmd, Money amount) /** * In case of an unsafe unpause, we want the * user to confirm that it might crash. - * @param w unused * @param confirmed whether the user confirmed their action */ -static void AskUnsafeUnpauseCallback(Window *w, bool confirmed) +static void AskUnsafeUnpauseCallback(Window *, bool confirmed) { if (confirmed) { Command::Post(PM_PAUSED_ERROR, false); @@ -191,11 +190,10 @@ CommandCost CmdPause(DoCommandFlag flags, PauseMode mode, bool pause) /** * Change the financial flow of your company. - * @param flags operation to perform * @param amount the amount of money to receive (if positive), or spend (if negative) * @return the cost of this operation or an error */ -CommandCost CmdMoneyCheat(DoCommandFlag flags, Money amount) +CommandCost CmdMoneyCheat(DoCommandFlag, Money amount) { return CommandCost(EXPENSES_OTHER, -amount); } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 658a2ec625..13f97e1b44 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -88,7 +88,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_LI_BACKGROUND) return; @@ -339,7 +339,7 @@ public: ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), static_cast(this->tile)); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_LI_LOCATION: @@ -357,7 +357,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -483,7 +483,7 @@ struct AboutWindow : public Window { if (widget == WID_A_COPYRIGHT) SetDParamStr(0, _openttd_revision_year); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_A_SCROLLING_TEXT) return; @@ -676,7 +676,7 @@ struct TooltipsWindow : public Window CLRBITS(this->flags, WF_WHITE_BORDER); } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { /* Find the free screen space between the main toolbar at the top, and the statusbar at the bottom. * Add a fixed distance 2 so the tooltip floats free from both bars. @@ -696,7 +696,7 @@ struct TooltipsWindow : public Window return pt; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { /* There is only one widget. */ CopyInDParam(this->params); @@ -980,7 +980,7 @@ struct QueryStringWindow : public Window this->ReInit(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_QS_DEFAULT && (this->flags & QSF_ENABLE_DEFAULT) == 0) { /* We don't want this widget to show! */ @@ -1019,7 +1019,7 @@ struct QueryStringWindow : public Window } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_QS_DEFAULT: @@ -1115,7 +1115,7 @@ struct QueryWindow : public Window { this->Window::Close(); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { /* Position query window over the calling window, ensuring it's within screen bounds. */ this->left = SoftClamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width); @@ -1133,7 +1133,7 @@ struct QueryWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_Q_TEXT) return; @@ -1151,7 +1151,7 @@ struct QueryWindow : public Window { this->message, TC_FROMSTRING, SA_CENTER); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_Q_YES: { @@ -1174,7 +1174,7 @@ struct QueryWindow : public Window { } } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { /* ESC closes the window, Enter confirms the action */ switch (keycode) { diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp index de2df23266..b4fd0da8b2 100644 --- a/src/music/allegro_m.cpp +++ b/src/music/allegro_m.cpp @@ -26,7 +26,7 @@ static MIDI *_midi = nullptr; */ extern int _allegro_instance_count; -const char *MusicDriver_Allegro::Start(const StringList ¶m) +const char *MusicDriver_Allegro::Start(const StringList &) { if (_allegro_instance_count == 0 && install_allegro(SYSTEM_AUTODETECT, &errno, nullptr)) { Debug(driver, 0, "allegro: install_allegro failed '{}'", allegro_error); diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index 5fc69b1f99..bd9dfc59a1 100644 --- a/src/music/cocoa_m.cpp +++ b/src/music/cocoa_m.cpp @@ -79,7 +79,7 @@ static void DoSetVolume() /** * Initialized the MIDI player, including QuickTime initialization. */ -const char *MusicDriver_Cocoa::Start(const StringList &parm) +const char *MusicDriver_Cocoa::Start(const StringList &) { if (NewMusicPlayer(&_player) != noErr) return "failed to create music player"; diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index 32fce42e2c..77b7a0c4d6 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -95,7 +95,7 @@ bool MusicDriver_ExtMidi::IsSongPlaying() return this->pid != -1; } -void MusicDriver_ExtMidi::SetVolume(byte vol) +void MusicDriver_ExtMidi::SetVolume(byte) { Debug(driver, 1, "extmidi: set volume not implemented"); } diff --git a/src/music/null_m.h b/src/music/null_m.h index 3a034110dc..5754f55642 100644 --- a/src/music/null_m.h +++ b/src/music/null_m.h @@ -15,17 +15,17 @@ /** The music player that does nothing. */ class MusicDriver_Null : public MusicDriver { public: - const char *Start(const StringList ¶m) override { return nullptr; } + const char *Start(const StringList &) override { return nullptr; } void Stop() override { } - void PlaySong(const MusicSongInfo &song) override { } + void PlaySong(const MusicSongInfo &) override { } void StopSong() override { } bool IsSongPlaying() override { return true; } - void SetVolume(byte vol) override { } + void SetVolume(byte) override { } const char *GetName() const override { return "null"; } }; diff --git a/src/music/win32_m.cpp b/src/music/win32_m.cpp index c72e8a47e3..2dd16b9c75 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -59,7 +59,7 @@ static byte ScaleVolume(byte original, byte scale) } -void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2) +void CALLBACK MidiOutProc(HMIDIOUT hmo, UINT wMsg, DWORD_PTR, DWORD_PTR dwParam1, DWORD_PTR) { if (wMsg == MOM_DONE) { MIDIHDR *hdr = (LPMIDIHDR)dwParam1; @@ -108,7 +108,7 @@ static void TransmitStandardSysex(MidiSysexMessage msg) * Realtime MIDI playback service routine. * This is called by the multimedia timer. */ -void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR dwUser, DWORD_PTR, DWORD_PTR) +void CALLBACK TimerCallback(UINT uTimerID, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) { /* Ensure only one timer callback is running at once, and prevent races on status flags */ std::unique_lock mutex_lock(_midi.lock, std::defer_lock); diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 7ef06425ce..2a2f1e2832 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -477,7 +477,7 @@ struct MusicTrackSelectionWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; for (int i = 0; i < 6; i++) { @@ -492,7 +492,7 @@ struct MusicTrackSelectionWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_MTS_PLAYLIST: { @@ -560,7 +560,7 @@ struct MusicTrackSelectionWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_MTS_LIST_LEFT: { // add to playlist @@ -674,7 +674,7 @@ struct MusicWindow : public Window { ); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { /* Make sure that WID_M_SHUFFLE and WID_M_PROGRAMME have the same size. @@ -763,7 +763,7 @@ struct MusicWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; for (int i = 0; i < 6; i++) { @@ -779,7 +779,7 @@ struct MusicWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_M_PREV: // skip to prev diff --git a/src/network/core/address.cpp b/src/network/core/address.cpp index fdff89544b..81a072c6e0 100644 --- a/src/network/core/address.cpp +++ b/src/network/core/address.cpp @@ -98,10 +98,9 @@ std::string NetworkAddress::GetAddressAsString(bool with_family) /** * Helper function to resolve without opening a socket. - * @param runp information about the socket to try not * @return the opened socket or INVALID_SOCKET */ -static SOCKET ResolveLoopProc(addrinfo *runp) +static SOCKET ResolveLoopProc(addrinfo *) { /* We just want the first 'entry', so return a valid socket. */ return !INVALID_SOCKET; diff --git a/src/network/core/http_curl.cpp b/src/network/core/http_curl.cpp index f8f591eaed..d49f753f3e 100644 --- a/src/network/core/http_curl.cpp +++ b/src/network/core/http_curl.cpp @@ -174,7 +174,7 @@ void HttpThread() * up to a second before this callback is called. There is little we can * do about this. */ curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L); - curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, +[](void *userdata, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) -> int { + curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, +[](void *userdata, curl_off_t /*dltotal*/, curl_off_t /*dlnow*/, curl_off_t /*ultotal*/, curl_off_t /*ulnow*/) -> int { const HTTPCallback *callback = static_cast(userdata); return (callback->IsCancelled() || _http_thread_exit) ? 1 : 0; }); diff --git a/src/network/core/http_none.cpp b/src/network/core/http_none.cpp index 41ba7c8cba..822c71f01c 100644 --- a/src/network/core/http_none.cpp +++ b/src/network/core/http_none.cpp @@ -18,7 +18,7 @@ #include "../../safeguards.h" -/* static */ void NetworkHTTPSocketHandler::Connect(const std::string &uri, HTTPCallback *callback, const std::string data) +/* static */ void NetworkHTTPSocketHandler::Connect(const std::string &, HTTPCallback *callback, const std::string) { /* No valid HTTP backend was compiled in, so we fail all HTTP requests. */ callback->OnFailure(); diff --git a/src/network/core/http_winhttp.cpp b/src/network/core/http_winhttp.cpp index 0d4744a808..c37711119a 100644 --- a/src/network/core/http_winhttp.cpp +++ b/src/network/core/http_winhttp.cpp @@ -186,7 +186,7 @@ void NetworkHTTPRequest::WinHttpCallback(DWORD code, void *info, DWORD length) } } -static void CALLBACK StaticWinHttpCallback(HINTERNET handle, DWORD_PTR context, DWORD code, void *info, DWORD length) +static void CALLBACK StaticWinHttpCallback(HINTERNET, DWORD_PTR context, DWORD code, void *info, DWORD length) { if (context == 0) return; diff --git a/src/network/core/os_abstraction.cpp b/src/network/core/os_abstraction.cpp index 74dbc2fe4b..8da0a3f3d0 100644 --- a/src/network/core/os_abstraction.cpp +++ b/src/network/core/os_abstraction.cpp @@ -129,7 +129,7 @@ bool NetworkError::HasError() const * @param d The socket to set the non-blocking more for. * @return True if setting the non-blocking mode succeeded, otherwise false. */ -bool SetNonBlocking(SOCKET d) +bool SetNonBlocking([[maybe_unused]] SOCKET d) { #if defined(_WIN32) u_long nonblocking = 1; @@ -147,7 +147,7 @@ bool SetNonBlocking(SOCKET d) * @param d The socket to disable the delaying for. * @return True if disabling the delaying succeeded, otherwise false. */ -bool SetNoDelay(SOCKET d) +bool SetNoDelay([[maybe_unused]] SOCKET d) { #ifdef __EMSCRIPTEN__ return true; diff --git a/src/network/core/tcp.cpp b/src/network/core/tcp.cpp index 3dc2a3fac8..626f978b42 100644 --- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -62,7 +62,7 @@ void NetworkTCPSocketHandler::CloseSocket() * @param error Whether we quit under an error condition or not. * @return new status of the connection. */ -NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection(bool error) +NetworkRecvStatus NetworkTCPSocketHandler::CloseConnection([[maybe_unused]] bool error) { this->MarkClosed(); this->writable = false; diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h index 74171ed86c..da79e1fa80 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -121,7 +121,7 @@ public: * Callback when the connection succeeded. * @param s the socket that we opened */ - virtual void OnConnect(SOCKET s) {} + virtual void OnConnect([[maybe_unused]] SOCKET s) {} /** * Callback for when the connection attempt failed. diff --git a/src/network/core/tcp_admin.cpp b/src/network/core/tcp_admin.cpp index 877ee93b26..895817cad3 100644 --- a/src/network/core/tcp_admin.cpp +++ b/src/network/core/tcp_admin.cpp @@ -32,7 +32,7 @@ NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) : status(ADMIN_ST this->sock = s; } -NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection(bool error) +NetworkRecvStatus NetworkAdminSocketHandler::CloseConnection(bool) { delete this; return NETWORK_RECV_STATUS_CLIENT_QUIT; @@ -129,40 +129,40 @@ NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket(PacketAdminTyp return NETWORK_RECV_STATUS_MALFORMED_PACKET; } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); } - -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); } - -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); } + +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); } + +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); } diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp index 350ae9fbb1..11df443b86 100644 --- a/src/network/core/tcp_content.cpp +++ b/src/network/core/tcp_content.cpp @@ -170,13 +170,13 @@ bool NetworkContentSocketHandler::ReceiveInvalidPacket(PacketContentType type) return false; } -bool NetworkContentSocketHandler::Receive_CLIENT_INFO_LIST(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_LIST); } -bool NetworkContentSocketHandler::Receive_CLIENT_INFO_ID(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_ID); } -bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID); } -bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID_MD5(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID_MD5); } -bool NetworkContentSocketHandler::Receive_SERVER_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_INFO); } -bool NetworkContentSocketHandler::Receive_CLIENT_CONTENT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_CONTENT); } -bool NetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_CONTENT); } +bool NetworkContentSocketHandler::Receive_CLIENT_INFO_LIST(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_LIST); } +bool NetworkContentSocketHandler::Receive_CLIENT_INFO_ID(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_ID); } +bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID); } +bool NetworkContentSocketHandler::Receive_CLIENT_INFO_EXTID_MD5(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_INFO_EXTID_MD5); } +bool NetworkContentSocketHandler::Receive_SERVER_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_INFO); } +bool NetworkContentSocketHandler::Receive_CLIENT_CONTENT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_CLIENT_CONTENT); } +bool NetworkContentSocketHandler::Receive_SERVER_CONTENT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CONTENT_SERVER_CONTENT); } /** * Helper to get the subdirectory a #ContentInfo is located in. diff --git a/src/network/core/tcp_coordinator.cpp b/src/network/core/tcp_coordinator.cpp index e10a3f9e01..cffb36ab6d 100644 --- a/src/network/core/tcp_coordinator.cpp +++ b/src/network/core/tcp_coordinator.cpp @@ -87,20 +87,20 @@ bool NetworkCoordinatorSocketHandler::ReceiveInvalidPacket(PacketCoordinatorType return false; } -bool NetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_ERROR); } -bool NetworkCoordinatorSocketHandler::Receive_SERVER_REGISTER(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_REGISTER); } -bool NetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_REGISTER_ACK); } -bool NetworkCoordinatorSocketHandler::Receive_SERVER_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_UPDATE); } -bool NetworkCoordinatorSocketHandler::Receive_CLIENT_LISTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_LISTING); } -bool NetworkCoordinatorSocketHandler::Receive_GC_LISTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_LISTING); } -bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECT); } -bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECTING(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECTING); } -bool NetworkCoordinatorSocketHandler::Receive_SERCLI_CONNECT_FAILED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_CONNECT_FAILED); } -bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECT_FAILED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECT_FAILED); } -bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECTED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECTED); } -bool NetworkCoordinatorSocketHandler::Receive_GC_DIRECT_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_DIRECT_CONNECT); } -bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_REQUEST(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_REQUEST); } -bool NetworkCoordinatorSocketHandler::Receive_SERCLI_STUN_RESULT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_STUN_RESULT); } -bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_CONNECT); } -bool NetworkCoordinatorSocketHandler::Receive_GC_NEWGRF_LOOKUP(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_NEWGRF_LOOKUP); } -bool NetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_TURN_CONNECT); } +bool NetworkCoordinatorSocketHandler::Receive_GC_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_ERROR); } +bool NetworkCoordinatorSocketHandler::Receive_SERVER_REGISTER(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_REGISTER); } +bool NetworkCoordinatorSocketHandler::Receive_GC_REGISTER_ACK(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_REGISTER_ACK); } +bool NetworkCoordinatorSocketHandler::Receive_SERVER_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERVER_UPDATE); } +bool NetworkCoordinatorSocketHandler::Receive_CLIENT_LISTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_LISTING); } +bool NetworkCoordinatorSocketHandler::Receive_GC_LISTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_LISTING); } +bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECT); } +bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECTING(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECTING); } +bool NetworkCoordinatorSocketHandler::Receive_SERCLI_CONNECT_FAILED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_CONNECT_FAILED); } +bool NetworkCoordinatorSocketHandler::Receive_GC_CONNECT_FAILED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_CONNECT_FAILED); } +bool NetworkCoordinatorSocketHandler::Receive_CLIENT_CONNECTED(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_CLIENT_CONNECTED); } +bool NetworkCoordinatorSocketHandler::Receive_GC_DIRECT_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_DIRECT_CONNECT); } +bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_REQUEST(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_REQUEST); } +bool NetworkCoordinatorSocketHandler::Receive_SERCLI_STUN_RESULT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_SERCLI_STUN_RESULT); } +bool NetworkCoordinatorSocketHandler::Receive_GC_STUN_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_STUN_CONNECT); } +bool NetworkCoordinatorSocketHandler::Receive_GC_NEWGRF_LOOKUP(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_NEWGRF_LOOKUP); } +bool NetworkCoordinatorSocketHandler::Receive_GC_TURN_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_COORDINATOR_GC_TURN_CONNECT); } diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp index 8960909e98..0f8051eef6 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -40,7 +40,7 @@ NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(nullptr), cl * For servers: close connection and that is it * @return the new status */ -NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool error) +NetworkRecvStatus NetworkGameSocketHandler::CloseConnection(bool) { /* Clients drop back to the main menu */ if (!_network_server && _networking) { @@ -156,50 +156,50 @@ NetworkRecvStatus NetworkGameSocketHandler::ReceiveInvalidPacket(PacketGameType return NETWORK_RECV_STATUS_MALFORMED_PACKET; } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_FULL); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_BANNED); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_JOIN); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_INFO); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_GAME_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_GAME_INFO); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CLIENT_INFO); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_GAME_PASSWORD); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_COMPANY_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_COMPANY_PASSWORD); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_PASSWORD); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMPANY_PASSWORD); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WELCOME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_WELCOME); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GETMAP); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WAIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_WAIT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_BEGIN); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_SIZE); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DATA); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DONE); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MAP_OK); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_JOIN); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_FRAME); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SYNC(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_SYNC); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ACK(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ACK); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMMAND); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMMAND(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMMAND); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_CHAT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHAT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_EXTERNAL_CHAT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_PASSWORD); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_NAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_NAME); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_QUIT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ERROR); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_QUIT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR_QUIT); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_SHUTDOWN); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEWGAME); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_RCON(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_RCON); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_RCON); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHECK_NEWGRFS); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_NEWGRFS_CHECKED); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_MOVE); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MOVE); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMPANY_UPDATE); } -NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(PACKET_SERVER_CONFIG_UPDATE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FULL(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_FULL); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_BANNED); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_JOIN); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_INFO); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_GAME_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_GAME_INFO); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CLIENT_INFO); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_GAME_PASSWORD); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEED_COMPANY_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEED_COMPANY_PASSWORD); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GAME_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GAME_PASSWORD); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMPANY_PASSWORD); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WELCOME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_WELCOME); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_GETMAP); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_WAIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_WAIT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_BEGIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_BEGIN); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_SIZE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_SIZE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DATA); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MAP_DONE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MAP_OK); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_JOIN); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_FRAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_FRAME); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SYNC(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_SYNC); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ACK(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ACK); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_COMMAND(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_COMMAND); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMMAND(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMMAND); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_CHAT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHAT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_EXTERNAL_CHAT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_EXTERNAL_CHAT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_PASSWORD(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_PASSWORD); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_SET_NAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_SET_NAME); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_QUIT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_ERROR); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_QUIT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_ERROR_QUIT(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_ERROR_QUIT); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_SHUTDOWN); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_NEWGAME); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_RCON(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_RCON); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_RCON(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_RCON); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CHECK_NEWGRFS); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_NEWGRFS_CHECKED); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_MOVE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_MOVE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_CLIENT_MOVE(Packet *) { return this->ReceiveInvalidPacket(PACKET_CLIENT_MOVE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_COMPANY_UPDATE); } +NetworkRecvStatus NetworkGameSocketHandler::Receive_SERVER_CONFIG_UPDATE(Packet *) { return this->ReceiveInvalidPacket(PACKET_SERVER_CONFIG_UPDATE); } void NetworkGameSocketHandler::DeferDeletion() { diff --git a/src/network/core/tcp_stun.cpp b/src/network/core/tcp_stun.cpp index b6aeff6836..1445fe30e5 100644 --- a/src/network/core/tcp_stun.cpp +++ b/src/network/core/tcp_stun.cpp @@ -26,4 +26,4 @@ bool NetworkStunSocketHandler::ReceiveInvalidPacket(PacketStunType type) return false; } -bool NetworkStunSocketHandler::Receive_SERCLI_STUN(Packet *p) { return this->ReceiveInvalidPacket(PACKET_STUN_SERCLI_STUN); } +bool NetworkStunSocketHandler::Receive_SERCLI_STUN(Packet *) { return this->ReceiveInvalidPacket(PACKET_STUN_SERCLI_STUN); } diff --git a/src/network/core/tcp_turn.cpp b/src/network/core/tcp_turn.cpp index c3c3ff8d83..76096aeb2b 100644 --- a/src/network/core/tcp_turn.cpp +++ b/src/network/core/tcp_turn.cpp @@ -66,6 +66,6 @@ bool NetworkTurnSocketHandler::ReceiveInvalidPacket(PacketTurnType type) return false; } -bool NetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_ERROR); } -bool NetworkTurnSocketHandler::Receive_SERCLI_CONNECT(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_SERCLI_CONNECT); } -bool NetworkTurnSocketHandler::Receive_TURN_CONNECTED(Packet *p) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_CONNECTED); } +bool NetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_ERROR); } +bool NetworkTurnSocketHandler::Receive_SERCLI_CONNECT(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_SERCLI_CONNECT); } +bool NetworkTurnSocketHandler::Receive_TURN_CONNECTED(Packet *) { return this->ReceiveInvalidPacket(PACKET_TURN_TURN_CONNECTED); } diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp index 4c226f0115..da7ac1221b 100644 --- a/src/network/core/udp.cpp +++ b/src/network/core/udp.cpp @@ -183,5 +183,5 @@ void NetworkUDPSocketHandler::ReceiveInvalidPacket(PacketUDPType type, NetworkAd Debug(net, 0, "[udp] Received packet type {} on wrong port from {}", type, client_addr->GetAddressAsString()); } -void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); } -void NetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_RESPONSE, client_addr); } +void NetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_CLIENT_FIND_SERVER, client_addr); } +void NetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *, NetworkAddress *client_addr) { this->ReceiveInvalidPacket(PACKET_UDP_SERVER_RESPONSE, client_addr); } diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp index 8a33b97c54..3e633f9b34 100644 --- a/src/network/network_admin.cpp +++ b/src/network/network_admin.cpp @@ -654,7 +654,7 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *p) return this->SendProtocol(); } -NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *p) +NetworkRecvStatus ServerNetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *) { /* The admin is leaving nothing else to do */ return this->CloseConnection(); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index c43b44172a..1ce4f58ba4 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -308,7 +308,7 @@ struct NetworkChatWindow : public Window { this->Window::Close(); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } @@ -436,7 +436,7 @@ struct NetworkChatWindow : public Window { } } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height }; return pt; @@ -451,7 +451,7 @@ struct NetworkChatWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NC_SENDBUTTON: /* Send */ @@ -464,7 +464,7 @@ struct NetworkChatWindow : public Window { } } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { EventState state = ES_NOT_HANDLED; if (keycode == WKC_TAB) { @@ -484,7 +484,7 @@ struct NetworkChatWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == this->dest) this->Close(); } diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 1407217237..85a20ed30d 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -534,7 +534,7 @@ bool ClientNetworkGameSocketHandler::IsConnected() extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr); -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *) { /* We try to join a server which is full */ ShowErrorMessage(STR_NETWORK_ERROR_SERVER_FULL, INVALID_STRING_ID, WL_CRITICAL); @@ -542,7 +542,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) return NETWORK_RECV_STATUS_SERVER_FULL; } -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *) { /* We try to join a server where we are banned */ ShowErrorMessage(STR_NETWORK_ERROR_SERVER_BANNED, INVALID_STRING_ID, WL_CRITICAL); @@ -685,7 +685,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_CHECK_NEWGRFS(P return ret; } -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEED_GAME_PASSWORD(Packet *) { if (this->status < STATUS_JOIN || this->status >= STATUS_AUTH_GAME) return NETWORK_RECV_STATUS_MALFORMED_PACKET; this->status = STATUS_AUTH_GAME; @@ -790,7 +790,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DATA(Packet return NETWORK_RECV_STATUS_OKAY; } -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_MAP_DONE(Packet *) { if (this->status != STATUS_MAP) return NETWORK_RECV_STATUS_MALFORMED_PACKET; if (this->savegame == nullptr) return NETWORK_RECV_STATUS_MALFORMED_PACKET; @@ -1035,7 +1035,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_JOIN(Packet *p) return NETWORK_RECV_STATUS_OKAY; } -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { /* Only when we're trying to join we really * care about the server shutting down. */ @@ -1048,7 +1048,7 @@ NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_SHUTDOWN(Packet return NETWORK_RECV_STATUS_SERVER_ERROR; } -NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *p) +NetworkRecvStatus ClientNetworkGameSocketHandler::Receive_SERVER_NEWGAME(Packet *) { /* Only when we're trying to join we really * care about the server shutting down. */ diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index cb0561369b..d54a61a1d2 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -792,7 +792,7 @@ void ClientNetworkContentSocketHandler::Connect() /** * Disconnect from the content server. */ -NetworkRecvStatus ClientNetworkContentSocketHandler::CloseConnection(bool error) +NetworkRecvStatus ClientNetworkContentSocketHandler::CloseConnection(bool) { this->isCancelled = true; NetworkContentSocketHandler::CloseConnection(); diff --git a/src/network/network_content.h b/src/network/network_content.h index d329dd90f0..ecf300729e 100644 --- a/src/network/network_content.h +++ b/src/network/network_content.h @@ -31,7 +31,7 @@ struct ContentCallback { * Callback for when the connection has finished * @param success whether the connection was made or that we failed to make it */ - virtual void OnConnect(bool success) {} + virtual void OnConnect([[maybe_unused]] bool success) {} /** * Callback for when the connection got disconnected. @@ -42,20 +42,20 @@ struct ContentCallback { * We received a content info. * @param ci the content info */ - virtual void OnReceiveContentInfo(const ContentInfo *ci) {} + virtual void OnReceiveContentInfo([[maybe_unused]] const ContentInfo *ci) {} /** * We have progress in the download of a file * @param ci the content info of the file * @param bytes the number of bytes downloaded since the previous call */ - virtual void OnDownloadProgress(const ContentInfo *ci, int bytes) {} + virtual void OnDownloadProgress([[maybe_unused]] const ContentInfo *ci, [[maybe_unused]] int bytes) {} /** * We have finished downloading a file * @param cid the ContentID of the downloaded file */ - virtual void OnDownloadComplete(ContentID cid) {} + virtual void OnDownloadComplete([[maybe_unused]] ContentID cid) {} /** Silentium */ virtual ~ContentCallback() = default; diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 2572b8a7b2..fb1f435473 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -114,7 +114,7 @@ void BaseNetworkContentDownloadStatusWindow::Close() this->Window::Close(); } -void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) +void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) { switch (widget) { case WID_NCDS_PROGRESS_BAR: @@ -285,7 +285,7 @@ public: this->BaseNetworkContentDownloadStatusWindow::Close(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget == WID_NCDS_CANCELOK) { if (this->downloaded_bytes != this->total_bytes) { @@ -581,7 +581,7 @@ public: this->checkbox_size = maxdim(maxdim(GetSpriteSize(SPR_BOX_EMPTY), GetSpriteSize(SPR_BOX_CHECKED)), GetSpriteSize(SPR_BLOT)); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NCL_CHECKBOX: @@ -788,7 +788,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_CONTENT_END) { if (this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE) return; @@ -873,7 +873,7 @@ public: } } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { if (this->vscroll->UpdateListPositionOnKeyPress(this->list_pos, keycode) == ES_NOT_HANDLED) { switch (keycode) { @@ -943,7 +943,7 @@ public: this->InvalidateData(0, false); } - void OnDownloadComplete(ContentID cid) override + void OnDownloadComplete(ContentID) override { this->content.ForceResort(); this->InvalidateData(); @@ -965,7 +965,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (this->content.NeedRebuild()) this->BuildContentList(); diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h index adf074e794..300095fe7e 100644 --- a/src/network/network_content_gui.h +++ b/src/network/network_content_gui.h @@ -33,7 +33,7 @@ public: BaseNetworkContentDownloadStatusWindow(WindowDesc *desc); void Close() override; - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override; + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override; void DrawWidget(const Rect &r, int widget) const override; void OnDownloadProgress(const ContentInfo *ci, int bytes) override; }; diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 2215a0cd6b..c8108a10f4 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -515,7 +515,7 @@ public: this->flag_offset = this->blot_offset + ScaleGUITrad(2) + GetSpriteSize(SPR_BLOT).width; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NG_MATRIX: @@ -720,7 +720,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NG_CANCEL: // Cancel button @@ -818,13 +818,13 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { this->servers.ForceRebuild(); this->SetDirty(); } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { EventState state = ES_NOT_HANDLED; @@ -888,7 +888,7 @@ public: } /** Refresh the online servers on a regular interval. */ - IntervalTimer refresh_interval = {std::chrono::seconds(30), [this](uint count) { + IntervalTimer refresh_interval = {std::chrono::seconds(30), [this](uint) { if (!this->searched_internet) return; _network_coordinator_client.GetListing(); @@ -1058,7 +1058,7 @@ struct NetworkStartServerWindow : public Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NSS_CONNTYPE_BTN: @@ -1078,7 +1078,7 @@ struct NetworkStartServerWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NSS_CANCEL: // Cancel button @@ -1369,30 +1369,27 @@ enum DropDownAdmin { /** * Callback function for admin command to kick client. - * @param w The window which initiated the confirmation dialog. * @param confirmed Iff the user pressed Yes. */ -static void AdminClientKickCallback(Window *w, bool confirmed) +static void AdminClientKickCallback(Window *, bool confirmed) { if (confirmed) NetworkServerKickClient(_admin_client_id, {}); } /** * Callback function for admin command to ban client. - * @param w The window which initiated the confirmation dialog. * @param confirmed Iff the user pressed Yes. */ -static void AdminClientBanCallback(Window *w, bool confirmed) +static void AdminClientBanCallback(Window *, bool confirmed) { if (confirmed) NetworkServerKickOrBanIP(_admin_client_id, true, {}); } /** * Callback function for admin command to reset company. - * @param w The window which initiated the confirmation dialog. * @param confirmed Iff the user pressed Yes. */ -static void AdminCompanyResetCallback(Window *w, bool confirmed) +static void AdminCompanyResetCallback(Window *, bool confirmed) { if (confirmed) { if (NetworkCompanyHasClients(_admin_company_id)) return; @@ -1402,10 +1399,9 @@ static void AdminCompanyResetCallback(Window *w, bool confirmed) /** * Callback function for admin command to unlock company. - * @param w The window which initiated the confirmation dialog. * @param confirmed Iff the user pressed Yes. */ -static void AdminCompanyUnlockCallback(Window *w, bool confirmed) +static void AdminCompanyUnlockCallback(Window *, bool confirmed) { if (confirmed) NetworkServerSetCompanyPassword(_admin_company_id, "", false); } @@ -1500,7 +1496,7 @@ private: * @param pt The point where this button was clicked. * @param company_id The company this button was assigned to. */ - static void OnClickCompanyChat(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void OnClickCompanyChat([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id) { ShowNetworkChatQueryWindow(DESTTYPE_TEAM, company_id); } @@ -1511,7 +1507,7 @@ private: * @param pt The point where this button was clicked. * @param company_id The company this button was assigned to. */ - static void OnClickCompanyJoin(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void OnClickCompanyJoin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id) { if (_network_server) { NetworkServerDoMove(CLIENT_ID_SERVER, company_id); @@ -1529,9 +1525,8 @@ private: * Crete new company button is clicked. * @param w The instance of this window. * @param pt The point where this button was clicked. - * @param company_id The company this button was assigned to. */ - static void OnClickCompanyNew(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void OnClickCompanyNew([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID) { if (_network_server) { Command::Post(CCA_NEW, INVALID_COMPANY, CRR_NONE, _network_own_client_id); @@ -1546,7 +1541,7 @@ private: * @param pt The point where this button was clicked. * @param client_id The client this button was assigned to. */ - static void OnClickClientAdmin(NetworkClientListWindow *w, Point pt, ClientID client_id) + static void OnClickClientAdmin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, ClientID client_id) { DropDownList list; list.emplace_back(new DropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_KICK, DD_CLIENT_ADMIN_KICK, false)); @@ -1568,7 +1563,7 @@ private: * @param pt The point where this button was clicked. * @param company_id The company this button was assigned to. */ - static void OnClickCompanyAdmin(NetworkClientListWindow *w, Point pt, CompanyID company_id) + static void OnClickCompanyAdmin([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, CompanyID company_id) { DropDownList list; list.emplace_back(new DropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_RESET, DD_COMPANY_ADMIN_RESET, NetworkCompanyHasClients(company_id))); @@ -1589,7 +1584,7 @@ private: * @param pt The point where this button was clicked. * @param client_id The client this button was assigned to. */ - static void OnClickClientChat(NetworkClientListWindow *w, Point pt, ClientID client_id) + static void OnClickClientChat([[maybe_unused]] NetworkClientListWindow *w, [[maybe_unused]] Point pt, ClientID client_id) { ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, client_id); } @@ -1717,7 +1712,7 @@ public: RebuildList(); } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { this->RebuildList(); @@ -1726,7 +1721,7 @@ public: this->SetWidgetDisabledState(WID_CL_SERVER_NAME_EDIT, !_network_server); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_CL_SERVER_VISIBILITY: @@ -1789,7 +1784,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_CL_SERVER_NAME_EDIT: @@ -1823,7 +1818,7 @@ public: } } - bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) override + bool OnTooltip([[maybe_unused]] Point pt, int widget, TooltipCloseCondition close_cond) override { switch (widget) { case WID_CL_MATRIX: { @@ -2116,7 +2111,7 @@ public: } } - void OnMouseOver(Point pt, int widget) override + void OnMouseOver([[maybe_unused]] Point pt, int widget) override { if (widget != WID_CL_MATRIX) { if (this->hover_index != -1) { @@ -2203,7 +2198,7 @@ struct NetworkJoinStatusWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NJS_PROGRESS_BAR: @@ -2229,7 +2224,7 @@ struct NetworkJoinStatusWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget == WID_NJS_CANCELOK) { // Disconnect button NetworkDisconnect(); @@ -2318,7 +2313,7 @@ struct NetworkCompanyPasswordWindow : public Window { this->ReInit(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_NCP_WARNING) { *size = this->warning_size; @@ -2342,7 +2337,7 @@ struct NetworkCompanyPasswordWindow : public Window { NetworkChangeCompanyPassword(_local_company, this->password_editbox.text.buf); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NCP_OK: @@ -2418,7 +2413,7 @@ struct NetworkAskRelayWindow : public Window { this->InitNested(0); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_NAR_TEXT) { *size = GetStringBoundingBox(STR_NETWORK_ASK_RELAY_TEXT); @@ -2434,7 +2429,7 @@ struct NetworkAskRelayWindow : public Window { } } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { /* Position query window over the calling window, ensuring it's within screen bounds. */ this->left = Clamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width); @@ -2452,7 +2447,7 @@ struct NetworkAskRelayWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NAR_NO: @@ -2521,7 +2516,7 @@ struct NetworkAskSurveyWindow : public Window { this->InitNested(0); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_NAS_TEXT) { *size = GetStringBoundingBox(STR_NETWORK_ASK_SURVEY_TEXT); @@ -2537,7 +2532,7 @@ struct NetworkAskSurveyWindow : public Window { } } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { /* Position query window over the calling window, ensuring it's within screen bounds. */ this->left = Clamp(parent->left + (parent->width / 2) - (this->width / 2), 0, _screen.width - this->width); @@ -2545,7 +2540,7 @@ struct NetworkAskSurveyWindow : public Window { this->SetDirty(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NAS_PREVIEW: diff --git a/src/network/network_query.cpp b/src/network/network_query.cpp index 441c22e816..f6671b066e 100644 --- a/src/network/network_query.cpp +++ b/src/network/network_query.cpp @@ -75,7 +75,7 @@ NetworkRecvStatus QueryNetworkGameSocketHandler::SendGameInfo() return NETWORK_RECV_STATUS_OKAY; } -NetworkRecvStatus QueryNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) +NetworkRecvStatus QueryNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *) { NetworkGameList *item = NetworkGameListAddItem(this->connection_string); item->status = NGLS_FULL; @@ -86,7 +86,7 @@ NetworkRecvStatus QueryNetworkGameSocketHandler::Receive_SERVER_FULL(Packet *p) return NETWORK_RECV_STATUS_CLOSE_QUERY; } -NetworkRecvStatus QueryNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *p) +NetworkRecvStatus QueryNetworkGameSocketHandler::Receive_SERVER_BANNED(Packet *) { NetworkGameList *item = NetworkGameListAddItem(this->connection_string); item->status = NGLS_BANNED; diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index d702321013..8a4960425e 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -799,12 +799,12 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::SendConfigUpdate() * DEF_SERVER_RECEIVE_COMMAND has parameter: NetworkClientSocket *cs, Packet *p ************/ -NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *p) +NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packet *) { return this->SendGameInfo(); } -NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *p) +NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_NEWGRFS_CHECKED(Packet *) { if (this->status != STATUS_NEWGRFS_CHECK) { /* Illegal call, return error and ignore the packet */ @@ -945,7 +945,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_COMPANY_PASSWOR return this->SendWelcome(); } -NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *p) +NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet *) { /* The client was never joined.. so this is impossible, right? * Ignore the packet, give the client a warning, and close the connection */ @@ -966,7 +966,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GETMAP(Packet * return this->SendMap(); } -NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *p) +NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_MAP_OK(Packet *) { /* Client has the map, now start syncing */ if (this->status == STATUS_DONE_MAP && !this->HasClientQuit()) { @@ -1107,7 +1107,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_ERROR(Packet *p return this->CloseConnection(NETWORK_RECV_STATUS_CLIENT_QUIT); } -NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *p) +NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_QUIT(Packet *) { /* The client was never joined.. thank the client for the packet, but ignore it */ if (this->status < STATUS_DONE_MAP || this->HasClientQuit()) { diff --git a/src/network/network_survey.cpp b/src/network/network_survey.cpp index 96f9c964a1..aa8cead44e 100644 --- a/src/network/network_survey.cpp +++ b/src/network/network_survey.cpp @@ -110,7 +110,7 @@ void NetworkSurveyHandler::OnFailure() this->loaded.notify_all(); } -void NetworkSurveyHandler::OnReceiveData(const char *data, size_t length) +void NetworkSurveyHandler::OnReceiveData(const char *data, size_t) { if (data == nullptr) { Debug(net, 1, "Survey: survey results sent"); diff --git a/src/network/network_turn.cpp b/src/network/network_turn.cpp index f47f8b9326..e6f48d535a 100644 --- a/src/network/network_turn.cpp +++ b/src/network/network_turn.cpp @@ -45,7 +45,7 @@ public: } }; -bool ClientNetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *p) +bool ClientNetworkTurnSocketHandler::Receive_TURN_ERROR(Packet *) { this->ConnectFailure(); diff --git a/src/network/network_udp.cpp b/src/network/network_udp.cpp index 7e7509fd70..4d5ff526ea 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -73,7 +73,7 @@ public: virtual ~ServerNetworkUDPSocketHandler() = default; }; -void ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *p, NetworkAddress *client_addr) +void ServerNetworkUDPSocketHandler::Receive_CLIENT_FIND_SERVER(Packet *, NetworkAddress *client_addr) { Packet packet(PACKET_UDP_SERVER_RESPONSE); this->SendPacket(&packet, client_addr); @@ -91,7 +91,7 @@ public: virtual ~ClientNetworkUDPSocketHandler() = default; }; -void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *p, NetworkAddress *client_addr) +void ClientNetworkUDPSocketHandler::Receive_SERVER_RESPONSE(Packet *, NetworkAddress *client_addr) { Debug(net, 3, "Server response from {}", client_addr->GetAddressAsString()); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 787b0cc386..a89addfcc4 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -8552,10 +8552,9 @@ static void StaticGRFInfo(ByteReader *buf) /** * Set the current NewGRF as unsafe for static use - * @param buf Unused. * @note Used during safety scan on unsafe actions. */ -static void GRFUnsafe(ByteReader *buf) +static void GRFUnsafe(ByteReader *) { SetBit(_cur.grfconfig->flags, GCF_UNSAFE); diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index fe7566a7d4..41e8c7021a 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -33,7 +33,7 @@ template } template -bool NewGRFClass::IsUIAvailable(uint index) const +bool NewGRFClass::IsUIAvailable(uint) const { return true; } @@ -153,7 +153,7 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as) } } -/* virtual */ uint32_t AirportScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t AirportScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { switch (variable) { case 0x40: return this->layout; diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index 273b0d60c8..eafcef04ac 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -166,7 +166,7 @@ struct AirportScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; void StorePSA(uint pos, int32_t value) override; }; diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index 1abf8b20bc..f9fa2f86d4 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -159,7 +159,7 @@ static uint32_t GetAirportTileIDAtOffset(TileIndex tile, const Station *st, uint return 0xFF << 8 | ats->grf_prop.subst_id; // so just give it the substitute } -/* virtual */ uint32_t AirportTileScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t AirportTileScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { assert(this->st != nullptr); @@ -231,7 +231,7 @@ uint32_t AirportTileResolverObject::GetDebugID() const return this->tiles_scope.ats->grf_prop.local_id; } -uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t param2, const AirportTileSpec *ats, Station *st, TileIndex tile, int extra_data = 0) +uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t param2, const AirportTileSpec *ats, Station *st, TileIndex tile, [[maybe_unused]] int extra_data = 0) { AirportTileResolverObject object(ats, tile, st, callback, param1, param2); return object.ResolveCallback(); diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h index c855d64c15..de1a984e2a 100644 --- a/src/newgrf_airporttiles.h +++ b/src/newgrf_airporttiles.h @@ -38,7 +38,7 @@ struct AirportTileScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Resolver for tiles of an airport. */ diff --git a/src/newgrf_animation_base.h b/src/newgrf_animation_base.h index e7ef4297e7..7ab4968194 100644 --- a/src/newgrf_animation_base.h +++ b/src/newgrf_animation_base.h @@ -19,8 +19,8 @@ template struct TileAnimationFrameAnimationHelper { - static byte Get(Tobj *obj, TileIndex tile) { return GetAnimationFrame(tile); } - static void Set(Tobj *obj, TileIndex tile, byte frame) { SetAnimationFrame(tile, frame); } + static byte Get(Tobj *, TileIndex tile) { return GetAnimationFrame(tile); } + static void Set(Tobj *, TileIndex tile, byte frame) { SetAnimationFrame(tile, frame); } }; /** diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp index 99f2ec13ca..23be82a76a 100644 --- a/src/newgrf_canal.cpp +++ b/src/newgrf_canal.cpp @@ -30,7 +30,7 @@ struct CanalScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Resolver object for canals. */ @@ -59,7 +59,7 @@ struct CanalResolverObject : public ResolverObject { return IsTileType(this->tile, MP_WATER) ? GetWaterTileRandomBits(this->tile) : 0; } -/* virtual */ uint32_t CanalScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t CanalScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { switch (variable) { /* Height of tile */ diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 27cb74dba5..a52ebf78a9 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -197,7 +197,7 @@ protected: uint16_t max_entities; ///< what is the amount of entities, old and new summed uint16_t invalid_id; ///< ID used to detected invalid entities - virtual bool CheckValidNewID(uint16_t testid) { return true; } + virtual bool CheckValidNewID([[maybe_unused]] uint16_t testid) { return true; } public: std::vector mappings; ///< mapping of ids from grf files. Public out of convenience diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 5c6e16576e..5bc4fb5182 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -226,9 +226,8 @@ void GRFParameterInfo::Finalize() /** * Update the palettes of the graphics from the config file. * Called when changing the default palette in advanced settings. - * @param new_value Unused. */ -void UpdateNewGRFConfigPalette(int32_t new_value) +void UpdateNewGRFConfigPalette(int32_t) { for (GRFConfig *c = _grfconfig_newgame; c != nullptr; c = c->next) c->SetSuitablePalette(); for (GRFConfig *c = _grfconfig_static; c != nullptr; c = c->next) c->SetSuitablePalette(); @@ -542,7 +541,7 @@ public: } }; -bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) +bool GRFFileScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &) { /* Abort if the user stopped the game during a scan. */ if (_exit_game) return false; diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index d7cd8e7495..0fc29e5715 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -184,7 +184,7 @@ public: * @param grfid Parameter for the PSA. Only required for items with parameters. * @return Size of the persistent storage in indices. */ - virtual uint GetPSASize(uint index, uint32_t grfid) const + virtual uint GetPSASize([[maybe_unused]] uint index, [[maybe_unused]] uint32_t grfid) const { return 0; } @@ -195,7 +195,7 @@ public: * @param grfid Parameter for the PSA. Only required for items with parameters. * @return Pointer to the first position of the storage array or nullptr if not present. */ - virtual const int32_t *GetPSAFirstPosition(uint index, uint32_t grfid) const + virtual const int32_t *GetPSAFirstPosition([[maybe_unused]] uint index, [[maybe_unused]] uint32_t grfid) const { return nullptr; } @@ -366,7 +366,7 @@ struct NewGRFInspectWindow : Window { GetFeatureHelper(this->window_number)->SetStringParameters(this->GetFeatureIndex()); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NGRFI_VEH_CHAIN: { @@ -555,7 +555,7 @@ struct NewGRFInspectWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NGRFI_PARENT: { @@ -623,7 +623,7 @@ struct NewGRFInspectWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (this->HasChainIndex()) { @@ -869,7 +869,7 @@ struct SpriteAlignerWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SA_SPRITE: @@ -934,7 +934,7 @@ struct SpriteAlignerWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SA_PREVIOUS: @@ -1044,7 +1044,7 @@ struct SpriteAlignerWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (data == 1) { diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 8eac2b0d7a..603e839929 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -954,7 +954,7 @@ static uint32_t VehicleGetVariable(Vehicle *v, const VehicleScopeResolver *objec return UINT_MAX; } -/* virtual */ uint32_t VehicleScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t VehicleScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->v == nullptr) { /* Vehicle does not exist, so we're in a purchase list */ diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index 8b7d2654fe..4452ad9caf 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -39,7 +39,7 @@ struct VehicleScopeResolver : public ScopeResolver { void SetVehicle(const Vehicle *v) { this->v = v; } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; uint32_t GetTriggers() const override; }; diff --git a/src/newgrf_generic.cpp b/src/newgrf_generic.cpp index 6c8fc95487..dcd660793c 100644 --- a/src/newgrf_generic.cpp +++ b/src/newgrf_generic.cpp @@ -41,7 +41,7 @@ struct GenericScopeResolver : public ScopeResolver { { } - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; private: bool ai_callback; ///< Callback comes from the AI. @@ -118,7 +118,7 @@ void AddGenericCallback(uint8_t feature, const GRFFile *file, const SpriteGroup _gcl[feature].push_front(GenericCallback(file, group)); } -/* virtual */ uint32_t GenericScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t GenericScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->ai_callback) { switch (variable) { diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 9a36d51f9a..acfe87ed58 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -208,7 +208,7 @@ struct NewGRFParametersWindow : public Window { return this->HasParameterInfo(nr) ? this->grf_config->param_info[nr].value() : GetDummyParameterInfo(nr); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NP_NUMPAR_DEC: @@ -329,7 +329,7 @@ struct NewGRFParametersWindow : public Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_NP_NUMPAR_DEC: @@ -459,7 +459,7 @@ struct NewGRFParametersWindow : public Window { this->SetDirty(); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. @@ -480,7 +480,7 @@ struct NewGRFParametersWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; if (!this->action14present) { @@ -733,7 +733,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_NS_FILE_LIST: @@ -932,7 +932,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_NS_NEWGRF_TEXTFILE && widget < WID_NS_NEWGRF_TEXTFILE + TFT_CONTENT_END) { if (this->active_sel == nullptr && this->avail_sel == nullptr) return; @@ -1223,7 +1223,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { * @param data Information about the changed data. @see GameOptionsInvalidationData * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; switch (data) { @@ -1334,7 +1334,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetDisabledState(WID_NS_PRESET_SAVE, has_missing); } - EventState OnKeyPress(char32_t key, uint16_t keycode) override + EventState OnKeyPress([[maybe_unused]] char32_t key, uint16_t keycode) override { if (!this->editable) return ES_NOT_HANDLED; @@ -2086,7 +2086,7 @@ struct SavePresetWindow : public Window { { } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SVP_PRESET_LIST: { @@ -2127,7 +2127,7 @@ struct SavePresetWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SVP_PRESET_LIST: { @@ -2201,7 +2201,7 @@ struct ScanProgressWindow : public Window { this->InitNested(1); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SP_PROGRESS_BAR: { diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp index ad05665a08..feab4c4fc0 100644 --- a/src/newgrf_house.cpp +++ b/src/newgrf_house.cpp @@ -294,7 +294,7 @@ static uint32_t GetDistanceFromNearbyHouse(uint8_t parameter, TileIndex tile, Ho /** * @note Used by the resolver to get values for feature 07 deterministic spritegroups. */ -/* virtual */ uint32_t HouseScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t HouseScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { switch (variable) { /* Construction stage. */ diff --git a/src/newgrf_house.h b/src/newgrf_house.h index 71e1390eea..296e9152be 100644 --- a/src/newgrf_house.h +++ b/src/newgrf_house.h @@ -43,7 +43,7 @@ struct HouseScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; uint32_t GetTriggers() const override; }; diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index acbf5c2d81..b25691267c 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -156,7 +156,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte param_setID, byte layo return count << 16 | GB(closest_dist, 0, 16); } -/* virtual */ uint32_t IndustriesScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t IndustriesScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->ro.callback == CBID_INDUSTRY_LOCATION) { /* Variables available during construction check. */ diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h index d4be4bad68..4cae362258 100644 --- a/src/newgrf_industries.h +++ b/src/newgrf_industries.h @@ -33,7 +33,7 @@ struct IndustriesScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; uint32_t GetTriggers() const override; void StorePSA(uint pos, int32_t value) override; }; diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index e24f5e0f80..62a4cd0c52 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -58,7 +58,7 @@ uint32_t GetRelativePosition(TileIndex tile, TileIndex ind_tile) return ((y & 0xF) << 20) | ((x & 0xF) << 16) | (y << 8) | x; } -/* virtual */ uint32_t IndustryTileScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t IndustryTileScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { switch (variable) { /* Construction state of the tile: a value between 0 and 3 */ @@ -251,7 +251,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind } /* Simple wrapper for GetHouseCallback to keep the animation unified. */ -uint16_t GetSimpleIndustryCallback(CallbackID callback, uint32_t param1, uint32_t param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile, int extra_data) +uint16_t GetSimpleIndustryCallback(CallbackID callback, uint32_t param1, uint32_t param2, const IndustryTileSpec *spec, Industry *ind, TileIndex tile, int) { return GetIndustryTileCallback(callback, param1, param2, spec - GetIndustryTileSpec(0), ind, tile); } diff --git a/src/newgrf_industrytiles.h b/src/newgrf_industrytiles.h index 79bc38d0ac..8d39a09d59 100644 --- a/src/newgrf_industrytiles.h +++ b/src/newgrf_industrytiles.h @@ -31,7 +31,7 @@ struct IndustryTileScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; uint32_t GetTriggers() const override; }; diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 624f5cfebd..c6098d54c7 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -253,7 +253,7 @@ static uint32_t GetCountAndDistanceOfClosestInstance(byte local_id, uint32_t grf } /** Used by the resolver to get values for feature 0F deterministic spritegroups. */ -/* virtual */ uint32_t ObjectScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t ObjectScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { /* We get the town from the object, or we calculate the closest * town if we need to when there's no object. */ @@ -524,10 +524,9 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8_t view) * @param spec The specification of the object / the entry point. * @param o The object to call the callback for. * @param tile The tile the callback is called for. - * @param extra_data Ignored. * @return The result of the callback. */ -uint16_t StubGetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2, const ObjectSpec *spec, Object *o, TileIndex tile, int extra_data) +uint16_t StubGetObjectCallback(CallbackID callback, uint32_t param1, uint32_t param2, const ObjectSpec *spec, Object *o, TileIndex tile, int) { return GetObjectCallback(callback, param1, param2, spec, o, tile); } diff --git a/src/newgrf_object.h b/src/newgrf_object.h index 2940f96440..644463674f 100644 --- a/src/newgrf_object.h +++ b/src/newgrf_object.h @@ -127,7 +127,7 @@ struct ObjectScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** A resolver object to be used with feature 0F spritegroups. */ diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index a95d686d45..1598a4d392 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -23,7 +23,7 @@ return GB(tmp, 0, 2); } -/* virtual */ uint32_t RailTypeScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t RailTypeScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->tile == INVALID_TILE) { switch (variable) { diff --git a/src/newgrf_railtype.h b/src/newgrf_railtype.h index af07556aef..d15f31d704 100644 --- a/src/newgrf_railtype.h +++ b/src/newgrf_railtype.h @@ -32,7 +32,7 @@ struct RailTypeScopeResolver : public ScopeResolver { } uint32_t GetRandomBits() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Resolver object for rail types. */ diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index bce9b5f21a..983bc0d06e 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -38,7 +38,7 @@ void NewGRFClass::InsertDefaults() } template -bool NewGRFClass::IsUIAvailable(uint index) const +bool NewGRFClass::IsUIAvailable(uint) const { return true; } @@ -63,7 +63,7 @@ uint32_t RoadStopScopeResolver::GetTriggers() const return this->st == nullptr ? 0 : this->st->waiting_triggers; } -uint32_t RoadStopScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +uint32_t RoadStopScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { auto get_road_type_variable = [&](RoadTramType rtt) -> uint32_t { RoadType rt; @@ -305,7 +305,7 @@ void DrawRoadStopTile(int x, int y, RoadType roadtype, const RoadStopSpec *spec, } /** Wrapper for animation control, see GetRoadStopCallback. */ -uint16_t GetAnimRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, int extra_data) +uint16_t GetAnimRoadStopCallback(CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, int) { return GetRoadStopCallback(callback, param1, param2, roadstopspec, st, tile, INVALID_ROADTYPE, GetStationType(tile), GetStationGfx(tile)); } diff --git a/src/newgrf_roadstop.h b/src/newgrf_roadstop.h index 0e453a76e3..87803dc8bc 100644 --- a/src/newgrf_roadstop.h +++ b/src/newgrf_roadstop.h @@ -89,7 +89,7 @@ struct RoadStopScopeResolver : public ScopeResolver { uint32_t GetRandomBits() const override; uint32_t GetTriggers() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Road stop resolver. */ diff --git a/src/newgrf_roadtype.cpp b/src/newgrf_roadtype.cpp index ab2897deaf..8e3f7ce7b5 100644 --- a/src/newgrf_roadtype.cpp +++ b/src/newgrf_roadtype.cpp @@ -23,7 +23,7 @@ return GB(tmp, 0, 2); } -/* virtual */ uint32_t RoadTypeScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t RoadTypeScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->tile == INVALID_TILE) { switch (variable) { diff --git a/src/newgrf_roadtype.h b/src/newgrf_roadtype.h index dc7acf636d..fb9194f623 100644 --- a/src/newgrf_roadtype.h +++ b/src/newgrf_roadtype.h @@ -33,7 +33,7 @@ struct RoadTypeScopeResolver : public ScopeResolver { } /* virtual */ uint32_t GetRandomBits() const; - /* virtual */ uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const; + /* virtual */ uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; }; /** Resolver object for road types. */ diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index e8ab9e6cba..d63f4061cc 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -103,7 +103,7 @@ static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver * * @param[out] available Set to false, in case the variable does not exist. * @return Value */ -/* virtual */ uint32_t ScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t ScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { Debug(grf, 1, "Unhandled scope variable 0x{:X}", variable); *available = false; @@ -112,10 +112,8 @@ static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver * /** * Store a value into the persistent storage area (PSA). Default implementation does nothing (for newgrf classes without storage). - * @param reg Position to store into. - * @param value Value to store. */ -/* virtual */ void ScopeResolver::StorePSA(uint reg, int32_t value) {} +/* virtual */ void ScopeResolver::StorePSA(uint, int32_t) {} /** * Get the real sprites of the grf. @@ -132,11 +130,9 @@ static inline uint32_t GetVariable(const ResolverObject &object, ScopeResolver * /** * Get a resolver for the \a scope. - * @param scope Scope to return. - * @param relative Additional parameter for #VSG_SCOPE_RELATIVE. * @return The resolver for the requested scope. */ -/* virtual */ ScopeResolver *ResolverObject::GetScope(VarSpriteGroupScope scope, byte relative) +/* virtual */ ScopeResolver *ResolverObject::GetScope(VarSpriteGroupScope, byte) { return &this->default_scope; } diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 9940cea163..c01f64f817 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -58,7 +58,7 @@ struct SpriteGroup : SpriteGroupPool::PoolItem<&_spritegroup_pool> { protected: SpriteGroup(SpriteGroupType type) : nfo_line(0), type(type) {} /** Base sprite group resolver */ - virtual const SpriteGroup *Resolve(ResolverObject &object) const { return this; }; + virtual const SpriteGroup *Resolve([[maybe_unused]] ResolverObject &object) const { return this; }; public: virtual ~SpriteGroup() = default; @@ -294,7 +294,7 @@ struct ScopeResolver { virtual uint32_t GetRandomBits() const; virtual uint32_t GetTriggers() const; - virtual uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const; + virtual uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; virtual void StorePSA(uint reg, int32_t value); }; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index fa120d3b23..35202de1ef 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -39,7 +39,7 @@ template } template -bool NewGRFClass::IsUIAvailable(uint index) const +bool NewGRFClass::IsUIAvailable(uint) const { return true; } @@ -266,7 +266,7 @@ TownScopeResolver *StationResolverObject::GetTown() return this->town_scope; } -/* virtual */ uint32_t StationScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t StationScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { if (this->st == nullptr) { /* Station does not exist, so we're in a purchase list or the land slope check callback. */ @@ -458,7 +458,7 @@ uint32_t Station::GetNewGRFVariable(const ResolverObject &object, byte variable, return UINT_MAX; } -uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &object, byte variable, byte parameter, bool *available) const +uint32_t Waypoint::GetNewGRFVariable(const ResolverObject &, byte variable, [[maybe_unused]] byte parameter, bool *available) const { switch (variable) { case 0x48: return 0; // Accepted cargo types @@ -886,7 +886,7 @@ bool CanStationTileHaveWires(TileIndex tile) } /** Wrapper for animation control, see GetStationCallback. */ -uint16_t GetAnimStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int extra_data) +uint16_t GetAnimStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int) { return GetStationCallback(callback, param1, param2, statspec, st, tile); } diff --git a/src/newgrf_station.h b/src/newgrf_station.h index b8be9935b8..885af41e27 100644 --- a/src/newgrf_station.h +++ b/src/newgrf_station.h @@ -43,7 +43,7 @@ struct StationScopeResolver : public ScopeResolver { uint32_t GetRandomBits() const override; uint32_t GetTriggers() const override; - uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Station resolver. */ diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp index d333a939f8..b071c3c743 100644 --- a/src/newgrf_storage.cpp +++ b/src/newgrf_storage.cpp @@ -51,7 +51,7 @@ void AddChangedPersistentStorage(BasePersistentStorageArray *storage) * @param mode Mode switch affecting temporary/persistent changes. * @param ignore_prev_mode Disable some sanity checks for exceptional call circumstances. */ -/* static */ void BasePersistentStorageArray::SwitchMode(PersistentStorageMode mode, bool ignore_prev_mode) +/* static */ void BasePersistentStorageArray::SwitchMode(PersistentStorageMode mode, [[maybe_unused]] bool ignore_prev_mode) { switch (mode) { case PSM_ENTER_GAMELOOP: diff --git a/src/newgrf_town.cpp b/src/newgrf_town.cpp index 6250690c42..5f8f5972c8 100644 --- a/src/newgrf_town.cpp +++ b/src/newgrf_town.cpp @@ -15,7 +15,7 @@ #include "safeguards.h" -/* virtual */ uint32_t TownScopeResolver::GetVariable(byte variable, uint32_t parameter, bool *available) const +/* virtual */ uint32_t TownScopeResolver::GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const { switch (variable) { /* Larger towns */ diff --git a/src/newgrf_town.h b/src/newgrf_town.h index 976243c074..f63f2794b1 100644 --- a/src/newgrf_town.h +++ b/src/newgrf_town.h @@ -34,7 +34,7 @@ struct TownScopeResolver : public ScopeResolver { { } - virtual uint32_t GetVariable(byte variable, uint32_t parameter, bool *available) const; + virtual uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; virtual void StorePSA(uint reg, int32_t value); }; diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 383dbc082a..2295009fe5 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -336,13 +336,13 @@ struct NewsWindow : Window { GfxFillRect( r.left, ir.bottom, r.right, r.bottom, PC_BLACK); } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = { 0, _screen.height }; return pt; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { StringID str = STR_NULL; switch (widget) { @@ -478,7 +478,7 @@ struct NewsWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_N_CLOSEBOX: @@ -540,7 +540,7 @@ struct NewsWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* The chatbar has notified us that is was either created or closed */ @@ -549,7 +549,7 @@ struct NewsWindow : Window { this->SetWindowTop(newtop); } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { /* Decrement the news timer. We don't need to action an elapsed event here, * so no need to use TimerElapsed(). */ @@ -1126,7 +1126,7 @@ struct MessageHistoryWindow : Window { this->OnInvalidateData(0); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_MH_BACKGROUND) { this->line_height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal; @@ -1181,13 +1181,13 @@ struct MessageHistoryWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->vscroll->SetCount(_total_news); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget == WID_MH_BACKGROUND) { NewsItem *ni = _latest_news; diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 3be124e5fd..fb39133dc7 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -486,7 +486,7 @@ static void DrawTile_Object(TileInfo *ti) DrawBridgeMiddle(ti); } -static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y, bool) { if (IsObjectType(tile, OBJECT_OWNED_LAND)) { int z; @@ -700,7 +700,7 @@ static void TileLoop_Object(TileIndex tile) } -static TrackStatus GetTileTrackStatus_Object(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Object(TileIndex, TransportType, uint, DiagDirection) { return 0; } @@ -721,10 +721,9 @@ static void AnimateTile_Object(TileIndex tile) /** * Helper function for \c CircularTileSearch. * @param tile The tile to check. - * @param user Ignored. * @return True iff the tile has a radio tower. */ -static bool HasTransmitter(TileIndex tile, void *user) +static bool HasTransmitter(TileIndex tile, void *) { return IsObjectTypeTile(tile, OBJECT_TRANSMITTER); } diff --git a/src/object_gui.cpp b/src/object_gui.cpp index f7f6fb8de7..8e43bdf554 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -222,7 +222,7 @@ public: this->object_margin = ScaleGUITrad(4); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BO_CLASS_LIST: { @@ -490,7 +490,7 @@ public: this->SetDirty(); } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -502,7 +502,7 @@ public: this->vscroll->SetCapacityFromWidget(this, WID_BO_CLASS_LIST); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BO_CLASS_LIST: { @@ -530,7 +530,7 @@ public: } } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { const ObjectSpec *spec = ObjectClass::Get(_selected_object_class)->GetSpec(_selected_object_index); @@ -541,12 +541,12 @@ public: } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x == -1) return; diff --git a/src/order_base.h b/src/order_base.h index 89d00a3d48..c607d97942 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -359,7 +359,7 @@ public: * into the shared vehicle chain. * @param v vehicle to add to the list */ - inline void AddVehicle(Vehicle *v) { ++this->num_vehicles; } + inline void AddVehicle([[maybe_unused]] Vehicle *v) { ++this->num_vehicles; } void RemoveVehicle(Vehicle *v); diff --git a/src/order_gui.cpp b/src/order_gui.cpp index 61595f4391..62742cb0e3 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -801,7 +801,7 @@ public: this->OnInvalidateData(VIWD_MODIFY_ORDERS); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_O_ORDER_LIST: @@ -838,7 +838,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { VehicleOrderID from = INVALID_VEH_ORDER_ID; VehicleOrderID to = INVALID_VEH_ORDER_ID; @@ -1161,7 +1161,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_O_ORDER_LIST: { @@ -1448,7 +1448,7 @@ public: return ES_HANDLED; } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { if (this->goto_type == OPOS_GOTO) { const Order cmd = GetOrderCmdFromTile(this->vehicle, tile); diff --git a/src/os/macosx/crashlog_osx.cpp b/src/os/macosx/crashlog_osx.cpp index 391a508143..3f8b7fe7ec 100644 --- a/src/os/macosx/crashlog_osx.cpp +++ b/src/os/macosx/crashlog_osx.cpp @@ -177,9 +177,8 @@ static sigset_t SetSignals(void(*handler)(int)) /** * Entry point for a crash that happened during the handling of a crash. * - * @param signum the signal that caused us to crash. */ -static void CDECL HandleInternalCrash(int signum) +static void CDECL HandleInternalCrash(int) { if (CrashLogOSX::current == nullptr || !CrashLogOSX::current->try_execute_active) { fmt::print("Something went seriously wrong when creating the crash log. Aborting.\n"); diff --git a/src/os/macosx/font_osx.cpp b/src/os/macosx/font_osx.cpp index 23737fc564..2eed279c1d 100644 --- a/src/os/macosx/font_osx.cpp +++ b/src/os/macosx/font_osx.cpp @@ -24,7 +24,7 @@ #include "safeguards.h" -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int winlangid, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback) { /* Determine fallback font using CoreText. This uses the language isocode * to find a suitable font. CoreText is available from 10.5 onwards. */ diff --git a/src/os/unix/crashlog_unix.cpp b/src/os/unix/crashlog_unix.cpp index f232bd121c..70cdc7be68 100644 --- a/src/os/unix/crashlog_unix.cpp +++ b/src/os/unix/crashlog_unix.cpp @@ -53,7 +53,7 @@ class CrashLogUnix : public CrashLog { survey["reason"] = strsignal(signum); } - void SurveyStacktrace(nlohmann::json &survey) const override + void SurveyStacktrace([[maybe_unused]] nlohmann::json &survey) const override { #if defined(__GLIBC__) void *trace[64]; @@ -166,7 +166,7 @@ static sigset_t SetSignals(void(*handler)(int)) * * @param signum the signal that caused us to crash. */ -static void CDECL HandleInternalCrash(int signum) +static void CDECL HandleInternalCrash([[maybe_unused]] int signum) { if (CrashLogUnix::current == nullptr || !CrashLogUnix::current->try_execute_active) { fmt::print("Something went seriously wrong when creating the crash log. Aborting.\n"); diff --git a/src/os/unix/font_unix.cpp b/src/os/unix/font_unix.cpp index 9e08aecdb7..87eac16384 100644 --- a/src/os/unix/font_unix.cpp +++ b/src/os/unix/font_unix.cpp @@ -95,7 +95,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face) return err; } -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int winlangid, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int, MissingGlyphSearcher *callback) { bool ret = false; diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp index f641bedcfd..b178581529 100644 --- a/src/os/unix/unix.cpp +++ b/src/os/unix/unix.cpp @@ -59,7 +59,7 @@ bool FiosIsRoot(const std::string &path) return path == PATHSEP; } -void FiosGetDrives(FileList &file_list) +void FiosGetDrives(FileList &) { return; } @@ -199,7 +199,7 @@ void ShowInfoI(const std::string &str) } #if !defined(__APPLE__) -void ShowOSErrorBox(const char *buf, bool system) +void ShowOSErrorBox(const char *buf, bool) { /* All unix systems, except OSX. Only use escape codes on a TTY. */ if (isatty(fileno(stderr))) { @@ -251,7 +251,7 @@ void OSOpenBrowser(const char *url) } #endif /* __APPLE__ */ -void SetCurrentThreadName(const char *threadName) { +void SetCurrentThreadName([[maybe_unused]] const char *threadName) { #if defined(__GLIBC__) if (threadName) pthread_setname_np(pthread_self(), threadName); #endif /* defined(__GLIBC__) */ diff --git a/src/os/windows/crashlog_win.cpp b/src/os/windows/crashlog_win.cpp index 281c090b50..7c05e81429 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -98,7 +98,7 @@ class CrashLogWindows : public CrashLog { public: #ifdef WITH_UNOFFICIAL_BREAKPAD - static bool MinidumpCallback(const wchar_t *dump_dir, const wchar_t *minidump_id, void *context, EXCEPTION_POINTERS *exinfo, MDRawAssertionInfo *assertion, bool succeeded) + static bool MinidumpCallback(const wchar_t *dump_dir, const wchar_t *minidump_id, void *context, EXCEPTION_POINTERS *, MDRawAssertionInfo *, bool succeeded) { CrashLogWindows *crashlog = reinterpret_cast(context); @@ -287,7 +287,7 @@ static const uint MAX_FRAMES = 64; } } #else -/* virtual */ void CrashLogWindows::SurveyStacktrace(nlohmann::json &survey) const +/* virtual */ void CrashLogWindows::SurveyStacktrace(nlohmann::json &) const { /* Not supported. */ } @@ -380,7 +380,7 @@ static LONG WINAPI VectoredExceptionHandler(EXCEPTION_POINTERS *ep) return EXCEPTION_CONTINUE_SEARCH; } -static void CDECL CustomAbort(int signal) +static void CDECL CustomAbort(int) { RaiseException(CUSTOM_ABORT_EXCEPTION, 0, 0, nullptr); } @@ -461,7 +461,7 @@ static void SetWndSize(HWND wnd, int mode) } } -static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_INITDIALOG: { diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 286702e0e9..4d92ee0217 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -88,7 +88,7 @@ static int CALLBACK EnumFontCallback(const ENUMLOGFONTEX *logfont, const NEWTEXT return 0; // stop enumerating } -bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_isocode, int winlangid, MissingGlyphSearcher *callback) +bool SetFallbackFont(FontCacheSettings *settings, const std::string &, int winlangid, MissingGlyphSearcher *callback) { Debug(fontcache, 1, "Trying fallback fonts"); EFCParam langInfo; diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index 49693ffe8d..3611dfe1af 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -45,7 +45,7 @@ bool MyShowCursor(bool show, bool toggle) return !show; } -void ShowOSErrorBox(const char *buf, bool system) +void ShowOSErrorBox(const char *buf, bool) { MyShowCursor(true); MessageBox(GetActiveWindow(), OTTD2FS(buf).c_str(), L"Error!", MB_ICONSTOP | MB_TASKMODAL); @@ -190,7 +190,7 @@ void FiosGetDrives(FileList &file_list) } } -bool FiosIsValidFile(const std::string &path, const struct dirent *ent, struct stat *sb) +bool FiosIsValidFile(const std::string &, const struct dirent *ent, struct stat *sb) { /* hectonanoseconds between Windows and POSIX epoch */ static const int64_t posix_epoch_hns = 0x019DB1DED53E8000LL; @@ -283,7 +283,7 @@ void CreateConsole() static const char *_help_msg; /** Callback function to handle the window */ -static INT_PTR CALLBACK HelpDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK HelpDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { case WM_INITDIALOG: { diff --git a/src/os/windows/win32_main.cpp b/src/os/windows/win32_main.cpp index 745d35cbab..ebc22ffc71 100644 --- a/src/os/windows/win32_main.cpp +++ b/src/os/windows/win32_main.cpp @@ -51,7 +51,7 @@ static int ParseCommandLine(char *line, char **argv, int max_argc) void CreateConsole(); -int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { /* Set system timer resolution to 1ms. */ timeBeginPeriod(1); diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 6c189e343f..4f4e56737b 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -101,7 +101,7 @@ struct OskWindow : public Window { DrawCharCentered(_keyboard[this->shift][widget], r, TC_BLACK); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { /* clicked a letter */ if (widget >= WID_OSK_LETTERS) { @@ -190,7 +190,7 @@ struct OskWindow : public Window { this->parent->SetWidgetDirty(this->text_btn); } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetDirty(WID_OSK_TEXT); diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index c1bf1ba44e..0868d97519 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -148,7 +148,7 @@ static uint NPFHash(TileIndex tile, Trackdir dir) return ((part1 << NPF_HASH_HALFBITS | part2) + (NPF_HASH_SIZE * dir / TRACKDIR_END)) % NPF_HASH_SIZE; } -static int32_t NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent) +static int32_t NPFCalcZero(AyStar *, AyStarNode *, OpenListNode *) { return 0; } @@ -156,7 +156,7 @@ static int32_t NPFCalcZero(AyStar *as, AyStarNode *current, OpenListNode *parent /* Calculates the heuristic to the target station or tile. For train stations, it * takes into account the direction of approach. */ -static int32_t NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, OpenListNode *parent) +static int32_t NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, OpenListNode *) { NPFFindStationOrTileData *fstd = (NPFFindStationOrTileData*)as->user_target; NPFFoundTargetData *ftd = (NPFFoundTargetData*)as->user_path; @@ -312,7 +312,7 @@ static Vehicle *CountShipProc(Vehicle *v, void *data) return nullptr; } -static int32_t NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent) +static int32_t NPFWaterPathCost(AyStar *, AyStarNode *current, OpenListNode *parent) { int32_t cost = 0; Trackdir trackdir = current->direction; @@ -340,7 +340,7 @@ static int32_t NPFWaterPathCost(AyStar *as, AyStarNode *current, OpenListNode *p } /* Determine the cost of this node, for road tracks */ -static int32_t NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *parent) +static int32_t NPFRoadPathCost(AyStar *, AyStarNode *current, OpenListNode *) { TileIndex tile = current->tile; int32_t cost = 0; diff --git a/src/pathfinder/npf/queue.cpp b/src/pathfinder/npf/queue.cpp index 0bd9046906..66b05004b4 100644 --- a/src/pathfinder/npf/queue.cpp +++ b/src/pathfinder/npf/queue.cpp @@ -130,7 +130,7 @@ bool BinaryHeap::Push(void *item, int priority) * known, which speeds up the deleting for some queue's. Should be -1 * if not known. */ -bool BinaryHeap::Delete(void *item, int priority) +bool BinaryHeap::Delete(void *item, int) { uint i = 0; diff --git a/src/pathfinder/yapf/yapf_costcache.hpp b/src/pathfinder/yapf/yapf_costcache.hpp index a1cd0625a9..2f453b846a 100644 --- a/src/pathfinder/yapf/yapf_costcache.hpp +++ b/src/pathfinder/yapf/yapf_costcache.hpp @@ -28,7 +28,7 @@ public: * Called by YAPF to attach cached or local segment cost data to the given node. * @return true if globally cached data were used or false if local data was used */ - inline bool PfNodeCacheFetch(Node &n) + inline bool PfNodeCacheFetch(Node &) { return false; } @@ -37,7 +37,7 @@ public: * Called by YAPF to flush the cached segment cost data back into cache storage. * Current cache implementation doesn't use that. */ - inline void PfNodeCacheFlush(Node &n) + inline void PfNodeCacheFlush(Node &) { } }; @@ -84,7 +84,7 @@ public: * Called by YAPF to flush the cached segment cost data back into cache storage. * Current cache implementation doesn't use that. */ - inline void PfNodeCacheFlush(Node &n) + inline void PfNodeCacheFlush(Node &) { } }; @@ -101,7 +101,7 @@ struct CSegmentCostCacheBase { static int s_rail_change_counter; - static void NotifyTrackLayoutChange(TileIndex tile, Track track) + static void NotifyTrackLayoutChange(TileIndex, Track) { s_rail_change_counter++; } @@ -213,7 +213,7 @@ public: * Called by YAPF to flush the cached segment cost data back into cache storage. * Current cache implementation doesn't use that. */ - inline void PfNodeCacheFlush(Node &n) + inline void PfNodeCacheFlush(Node &) { } }; diff --git a/src/pathfinder/yapf/yapf_destrail.hpp b/src/pathfinder/yapf/yapf_destrail.hpp index 1c41579cba..e9167d3fdb 100644 --- a/src/pathfinder/yapf/yapf_destrail.hpp +++ b/src/pathfinder/yapf/yapf_destrail.hpp @@ -52,7 +52,7 @@ public: } /** Called by YAPF to detect if node ends in the desired destination */ - inline bool PfDetectDestination(TileIndex tile, Trackdir td) + inline bool PfDetectDestination(TileIndex tile, Trackdir) { bool bDest = IsRailDepotTile(tile); return bDest; diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index 1b6f1a2528..ee7ba618be 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -417,7 +417,7 @@ public: return result1; } - inline Trackdir ChooseRailTrack(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool reserve_track, PBSTileInfo *target, TileIndex *dest) + inline Trackdir ChooseRailTrack(const Train *v, TileIndex, DiagDirection, TrackBits, bool &path_found, bool reserve_track, PBSTileInfo *target, TileIndex *dest) { if (target != nullptr) target->tile = INVALID_TILE; if (dest != nullptr) *dest = INVALID_TILE; diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index 5d47aace83..13854dbfcc 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -35,7 +35,7 @@ protected: return *static_cast(this); } - int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir trackdir) + int SlopeCost(TileIndex tile, TileIndex next_tile, Trackdir) { /* height of the center of the current tile */ int x1 = TileX(tile) * TILE_SIZE; @@ -109,7 +109,7 @@ public: * Calculates only the cost of given node, adds it to the parent node cost * and stores the result into Node::m_cost member */ - inline bool PfCalcCost(Node &n, const TrackFollower *tf) + inline bool PfCalcCost(Node &n, const TrackFollower *) { int segment_cost = 0; uint tiles = 0; @@ -202,7 +202,7 @@ public: return IsRoadDepotTile(n.m_segment_last_tile); } - inline bool PfDetectDestinationTile(TileIndex tile, Trackdir trackdir) + inline bool PfDetectDestinationTile(TileIndex tile, Trackdir) { return IsRoadDepotTile(tile); } diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 762f2bf855..46d6f9a030 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2566,7 +2566,7 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype) DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette); } -static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y, bool) { if (IsPlainRail(tile)) { int z; @@ -2709,7 +2709,7 @@ set_ground: } -static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode, uint, DiagDirection side) { /* Case of half tile slope with water. */ if (mode == TRANSPORT_WATER && IsPlainRail(tile) && GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(GetTileSlope(tile))) { @@ -3034,7 +3034,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old /** * Test-procedure for HasVehicleOnPos to check for a ship. */ -static Vehicle *EnsureNoShipProc(Vehicle *v, void *data) +static Vehicle *EnsureNoShipProc(Vehicle *v, void *) { return v->type == VEH_SHIP ? v : nullptr; } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 675f27b872..2bf47f86a9 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -89,7 +89,7 @@ static bool IsStationAvailable(const StationSpec *statspec) return Convert8bitBooleanCallback(statspec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res); } -void CcPlaySound_CONSTRUCTION_RAIL(Commands cmd, const CommandCost &result, TileIndex tile) +void CcPlaySound_CONSTRUCTION_RAIL(Commands, const CommandCost &result, TileIndex tile) { if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile); } @@ -135,7 +135,7 @@ static const DiagDirection _place_depot_extra_dir[12] = { DIAGDIR_NW, DIAGDIR_NE, DIAGDIR_NW, DIAGDIR_NE, }; -void CcRailDepot(Commands cmd, const CommandCost &result, TileIndex tile, RailType rt, DiagDirection dir) +void CcRailDepot(Commands, const CommandCost &result, TileIndex tile, RailType, DiagDirection dir) { if (result.Failed()) return; @@ -174,7 +174,7 @@ static void PlaceRail_Waypoint(TileIndex tile) } } -void CcStation(Commands cmd, const CommandCost &result, TileIndex tile) +void CcStation(Commands, const CommandCost &result, TileIndex tile) { if (result.Failed()) return; @@ -273,7 +273,7 @@ static void PlaceRail_Bridge(TileIndex tile, Window *w) } /** Command callback for building a tunnel */ -void CcBuildRailTunnel(Commands cmd, const CommandCost &result, TileIndex tile) +void CcBuildRailTunnel(Commands, const CommandCost &result, TileIndex tile) { if (result.Succeeded()) { if (_settings_client.sound.confirm) SndPlayTileFx(SND_20_CONSTRUCTION_RAIL, tile); @@ -502,7 +502,7 @@ struct BuildRailToolbarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget < WID_RAT_BUILD_NS) return; @@ -599,7 +599,7 @@ struct BuildRailToolbarWindow : Window { return Window::OnHotkey(hotkey); } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_RAT_BUILD_NS: @@ -658,7 +658,7 @@ struct BuildRailToolbarWindow : Window { } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { /* no dragging if you have pressed the convert button */ if (FindWindowById(WC_BUILD_SIGNAL, 0) != nullptr && _convert_signal_button && this->IsWidgetLowered(WID_RAT_BUILD_SIGNALS)) return; @@ -666,7 +666,7 @@ struct BuildRailToolbarWindow : Window { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -746,7 +746,7 @@ struct BuildRailToolbarWindow : Window { CloseWindowByClass(WC_BUILD_BRIDGE); } - void OnPlacePresize(Point pt, TileIndex tile) override + void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile) override { Command::Do(DC_AUTO, tile, TRANSPORT_RAIL, _cur_railtype); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); @@ -759,7 +759,7 @@ struct BuildRailToolbarWindow : Window { return ES_NOT_HANDLED; } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { if (this->IsWidgetLowered(WID_RAT_BUILD_WAYPOINT)) CheckRedrawWaypointCoverage(this); } @@ -1105,7 +1105,7 @@ public: _railstation.station_class = station_class; } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -1183,7 +1183,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BRAS_NEWST_LIST: { @@ -1320,7 +1320,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRAS_PLATFORM_DIR_X: @@ -1487,7 +1487,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -1718,7 +1718,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) { /* Two digits for signals density. */ @@ -1752,7 +1752,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BS_SEMAPHORE_NORM: @@ -1818,7 +1818,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->LowerWidget((_cur_signal_variant == SIG_ELECTRIC ? WID_BS_ELECTRIC_NORM : WID_BS_SEMAPHORE_NORM) + _cur_signal_type); @@ -1907,7 +1907,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { this->LowerWidget(_build_depot_direction + WID_BRAD_DEPOT_NE); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (!IsInsideMM(widget, WID_BRAD_DEPOT_NE, WID_BRAD_DEPOT_NW + 1)) return; @@ -1928,7 +1928,7 @@ struct BuildRailDepotWindow : public PickerWindowBase { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BRAD_DEPOT_NE: @@ -2072,7 +2072,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BRW_WAYPOINT_MATRIX: @@ -2135,7 +2135,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BRW_WAYPOINT: { @@ -2156,7 +2156,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->list.ForceRebuild(); @@ -2170,7 +2170,7 @@ struct BuildRailWaypointWindow : PickerWindowBase { } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawWaypointCoverage(this); } @@ -2291,9 +2291,8 @@ static void SetDefaultRailGui() /** * Updates the current signal variant used in the signal GUI * to the one adequate to current year. - * @param new_value needed to be called when a setting changes */ -void ResetSignalVariant(int32_t new_value) +void ResetSignalVariant(int32_t) { SignalVariant new_variant = (TimerGameCalendar::year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 2e16f25a92..29791c6c24 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1905,7 +1905,7 @@ void UpdateNearestTownForRoadTiles(bool invalidate) } } -static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y, bool) { if (IsNormalRoad(tile)) { @@ -2222,7 +2222,7 @@ static const byte _roadveh_enter_depot_dir[4] = { TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_X_NE, TRACKDIR_Y_SE }; -static VehicleEnterTileStatus VehicleEnter_Road(Vehicle *v, TileIndex tile, int x, int y) +static VehicleEnterTileStatus VehicleEnter_Road(Vehicle *v, TileIndex tile, int, int) { switch (GetRoadTileType(tile)) { case ROAD_TILE_DEPOT: { diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 2d7cfa763a..b67f5750af 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -98,7 +98,7 @@ static bool IsRoadStopAvailable(const RoadStopSpec *roadstopspec, StationType ty return Convert8bitBooleanCallback(roadstopspec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res); } -void CcPlaySound_CONSTRUCTION_OTHER(Commands cmd, const CommandCost &result, TileIndex tile) +void CcPlaySound_CONSTRUCTION_OTHER(Commands, const CommandCost &result, TileIndex tile) { if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile); } @@ -121,11 +121,10 @@ static void PlaceRoad_Bridge(TileIndex tile, Window *w) /** * Callback executed after a build road tunnel command has been called. * - * @param cmd unused * @param result Whether the build succeeded. * @param start_tile Starting tile of the tunnel. */ -void CcBuildRoadTunnel(Commands cmd, const CommandCost &result, TileIndex start_tile) +void CcBuildRoadTunnel(Commands, const CommandCost &result, TileIndex start_tile) { if (result.Succeeded()) { if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, start_tile); @@ -158,7 +157,7 @@ void ConnectRoadToStructure(TileIndex tile, DiagDirection direction) } } -void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadType rt, DiagDirection dir) +void CcRoadDepot(Commands, const CommandCost &result, TileIndex tile, RoadType, DiagDirection dir) { if (result.Failed()) return; @@ -169,7 +168,6 @@ void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadTy /** * Command callback for building road stops. - * @param cmd Unused. * @param result Result of the build road stop command. * @param tile Start tile. * @param width Width of the road stop. @@ -180,7 +178,7 @@ void CcRoadDepot(Commands cmd, const CommandCost &result, TileIndex tile, RoadTy * @param spec_index Road stop spec index. * @see CmdBuildRoadStop */ -void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8_t width, uint8_t length, RoadStopType, bool is_drive_through, +void CcRoadStop(Commands, const CommandCost &result, TileIndex tile, uint8_t width, uint8_t length, RoadStopType, bool is_drive_through, DiagDirection dir, RoadType, RoadStopClassID spec_class, uint16_t spec_index, StationID, bool) { if (result.Failed()) return; @@ -341,7 +339,7 @@ struct BuildRoadToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; RoadTramType rtt = GetRoadTramType(this->roadtype); @@ -472,7 +470,7 @@ struct BuildRoadToolbarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { _remove_button_clicked = false; _one_way_button_clicked = false; @@ -560,7 +558,7 @@ struct BuildRoadToolbarWindow : Window { return Window::OnHotkey(hotkey); } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { _remove_button_clicked = this->IsWidgetLowered(WID_ROT_REMOVE); _one_way_button_clicked = RoadTypeIsRoad(this->roadtype) ? this->IsWidgetLowered(WID_ROT_ONE_WAY) : false; @@ -638,7 +636,7 @@ struct BuildRoadToolbarWindow : Window { CloseWindowByClass(WC_BUILD_BRIDGE); } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { /* Here we update the end tile flags * of the road placement actions. @@ -677,7 +675,7 @@ struct BuildRoadToolbarWindow : Window { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -737,7 +735,7 @@ struct BuildRoadToolbarWindow : Window { } } - void OnPlacePresize(Point pt, TileIndex tile) override + void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile) override { Command::Do(DC_AUTO, tile, TRANSPORT_ROAD, _cur_roadtype); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); @@ -1018,7 +1016,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { this->FinishInitNested(TRANSPORT_ROAD); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (!IsInsideMM(widget, WID_BROD_DEPOT_NE, WID_BROD_DEPOT_NW + 1)) return; @@ -1039,7 +1037,7 @@ struct BuildRoadDepotWindow : public PickerWindowBase { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BROD_DEPOT_NW: @@ -1290,7 +1288,7 @@ public: } } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -1344,7 +1342,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_BROS_NEWST_LIST: { @@ -1492,7 +1490,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (GB(widget, 0, 16)) { case WID_BROS_STATION_NE: @@ -1570,7 +1568,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } diff --git a/src/roadveh.h b/src/roadveh.h index d721170629..90b02ba878 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -166,7 +166,7 @@ protected: // These functions should not be called outside acceleration code. * Returns a value if this articulated part is powered. * @return Zero, because road vehicles don't have powered parts. */ - inline uint16_t GetPoweredPartPower(const RoadVehicle *head) const + inline uint16_t GetPoweredPartPower(const RoadVehicle *) const { return 0; } diff --git a/src/saveload/game_sl.cpp b/src/saveload/game_sl.cpp index 8aa4805576..bcf3189b82 100644 --- a/src/saveload/game_sl.cpp +++ b/src/saveload/game_sl.cpp @@ -34,7 +34,7 @@ static const SaveLoad _game_script_desc[] = { SLEG_VAR("is_random", _game_saveload_is_random, SLE_BOOL), }; -static void SaveReal_GSDT(int *index_ptr) +static void SaveReal_GSDT(int *) { GameConfig *config = GameConfig::GetConfig(); diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index cb1e261eeb..54c4f51090 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -638,7 +638,7 @@ static bool LoadOldOrder(LoadgameState *ls, int num) return true; } -static bool LoadOldAnimTileList(LoadgameState *ls, int num) +static bool LoadOldAnimTileList(LoadgameState *ls, int) { TileIndex anim_list[256]; const OldChunks anim_chunk[] = { @@ -894,7 +894,7 @@ static const OldChunks _company_economy_chunk[] = { OCL_END() }; -static bool LoadOldCompanyEconomy(LoadgameState *ls, int num) +static bool LoadOldCompanyEconomy(LoadgameState *ls, int) { Company *c = Company::Get(_current_company_id); @@ -1097,7 +1097,7 @@ static const OldChunks vehicle_empty_chunk[] = { OCL_END() }; -static bool LoadOldVehicleUnion(LoadgameState *ls, int num) +static bool LoadOldVehicleUnion(LoadgameState *ls, int) { Vehicle *v = Vehicle::GetIfValid(_current_vehicle_id); uint temp = ls->total_read; @@ -1464,7 +1464,7 @@ static const OldChunks game_difficulty_chunk[] = { OCL_END() }; -static bool LoadOldGameDifficulty(LoadgameState *ls, int num) +static bool LoadOldGameDifficulty(LoadgameState *ls, int) { bool ret = LoadChunk(ls, &_settings_game.difficulty, game_difficulty_chunk); _settings_game.difficulty.max_loan *= 1000; @@ -1472,7 +1472,7 @@ static bool LoadOldGameDifficulty(LoadgameState *ls, int num) } -static bool LoadOldMapPart1(LoadgameState *ls, int num) +static bool LoadOldMapPart1(LoadgameState *ls, int) { if (_savegame_type == SGT_TTO) { Map::Allocate(OLD_MAP_SIZE, OLD_MAP_SIZE); @@ -1502,7 +1502,7 @@ static bool LoadOldMapPart1(LoadgameState *ls, int num) return true; } -static bool LoadOldMapPart2(LoadgameState *ls, int num) +static bool LoadOldMapPart2(LoadgameState *ls, int) { uint i; @@ -1516,7 +1516,7 @@ static bool LoadOldMapPart2(LoadgameState *ls, int num) return true; } -static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num) +static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int) { ReadTTDPatchFlags(); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index cb2fccc065..124ae8239a 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1711,7 +1711,7 @@ void SlObject(void *object, const SaveLoadTable &slt) * is not known to the code. This means we are going to skip it. */ class SlSkipHandler : public SaveLoadHandler { - void Save(void *object) const override + void Save(void *) const override { NOT_REACHED(); } @@ -2339,9 +2339,8 @@ struct LZOSaveFilter : SaveFilter { /** * Initialise this filter. * @param chain The next filter in this chain. - * @param compression_level The requested level of compression. */ - LZOSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain) + LZOSaveFilter(SaveFilter *chain, byte) : SaveFilter(chain) { if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); } @@ -2396,9 +2395,8 @@ struct NoCompSaveFilter : SaveFilter { /** * Initialise this filter. * @param chain The next filter in this chain. - * @param compression_level The requested level of compression. */ - NoCompSaveFilter(SaveFilter *chain, byte compression_level) : SaveFilter(chain) + NoCompSaveFilter(SaveFilter *chain, byte) : SaveFilter(chain) { } diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index df02b235f4..3e4953a061 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -493,25 +493,25 @@ public: * Save the object to disk. * @param object The object to store. */ - virtual void Save(void *object) const {} + virtual void Save([[maybe_unused]] void *object) const {} /** * Load the object from disk. * @param object The object to load. */ - virtual void Load(void *object) const {} + virtual void Load([[maybe_unused]] void *object) const {} /** * Similar to load, but used only to validate savegames. * @param object The object to load. */ - virtual void LoadCheck(void *object) const {} + virtual void LoadCheck([[maybe_unused]] void *object) const {} /** * A post-load callback to fix #SL_REF integers into pointers. * @param object The object to fix. */ - virtual void FixPointers(void *object) const {} + virtual void FixPointers([[maybe_unused]] void *object) const {} /** * Get the description of the fields in the savegame. @@ -548,16 +548,16 @@ public: SaveLoadTable GetDescription() const override { return static_cast(this)->description; } SaveLoadCompatTable GetCompatDescription() const override { return static_cast(this)->compat_description; } - virtual void Save(TObject *object) const {} + virtual void Save([[maybe_unused]] TObject *object) const {} void Save(void *object) const override { this->Save(static_cast(object)); } - virtual void Load(TObject *object) const {} + virtual void Load([[maybe_unused]] TObject *object) const {} void Load(void *object) const override { this->Load(static_cast(object)); } - virtual void LoadCheck(TObject *object) const {} + virtual void LoadCheck([[maybe_unused]] TObject *object) const {} void LoadCheck(void *object) const override { this->LoadCheck(static_cast(object)); } - virtual void FixPointers(TObject *object) const {} + virtual void FixPointers([[maybe_unused]] TObject *object) const {} void FixPointers(void *object) const override { this->FixPointers(static_cast(object)); } }; diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp index 695a51b0c0..82b2d85151 100644 --- a/src/saveload/town_sl.cpp +++ b/src/saveload/town_sl.cpp @@ -190,7 +190,7 @@ public: }; inline const static SaveLoadCompatTable compat_description = _town_acceptance_matrix_sl_compat; - void Load(Town *t) const override + void Load(Town *) const override { /* Discard now unused acceptance matrix. */ AcceptanceMatrix dummy; diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 386b5e4a27..5b9ce9388b 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -599,7 +599,7 @@ void InitializeScreenshotFormats() * Callback of the screenshot generator that dumps the current video buffer. * @see ScreenshotCallback */ -static void CurrentScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n) +static void CurrentScreenCallback(void *, void *buf, uint y, uint pitch, uint n) { Blitter *blitter = BlitterFactory::GetCurrentBlitter(); void *src = blitter->MoveTo(_screen.dst_ptr, 0, y); @@ -811,14 +811,12 @@ static bool MakeLargeWorldScreenshot(ScreenshotType t, uint32_t width = 0, uint3 /** * Callback for generating a heightmap. Supports 8bpp grayscale only. - * @param userdata Pointer to user data. * @param buffer Destination buffer. * @param y Line number of the first line to write. - * @param pitch Number of pixels to write (1 byte for 8bpp, 4 bytes for 32bpp). @see Colour * @param n Number of lines to write. * @see ScreenshotCallback */ -static void HeightmapCallback(void *userdata, void *buffer, uint y, uint pitch, uint n) +static void HeightmapCallback(void *, void *buffer, uint y, uint, uint n) { byte *buf = (byte *)buffer; while (n > 0) { @@ -862,10 +860,9 @@ static ScreenshotType _confirmed_screenshot_type; ///< Screenshot type the curre /** * Callback on the confirmation window for huge screenshots. - * @param w Window with viewport * @param confirmed true on confirmation */ -static void ScreenshotConfirmationCallback(Window *w, bool confirmed) +static void ScreenshotConfirmationCallback(Window *, bool confirmed) { if (confirmed) MakeScreenshot(_confirmed_screenshot_type, {}); } @@ -996,7 +993,7 @@ bool MakeScreenshot(ScreenshotType t, std::string name, uint32_t width, uint32_t } -static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n) +static void MinimapScreenCallback(void *, void *buf, uint y, uint pitch, uint n) { uint32_t *ubuf = (uint32_t *)buf; uint num = (pitch * n); diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index 2ace881092..060eb4933e 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -27,7 +27,7 @@ struct ScreenshotWindow : Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget < 0) return; ScreenshotType st; diff --git a/src/script/api/script_base.cpp b/src/script/api/script_base.cpp index ab5dd848bc..18c3519b65 100644 --- a/src/script/api/script_base.cpp +++ b/src/script/api/script_base.cpp @@ -18,7 +18,7 @@ return ScriptObject::GetRandomizer().Next(); } -/* static */ SQInteger ScriptBase::RandItem(SQInteger unused_param) +/* static */ SQInteger ScriptBase::RandItem(SQInteger) { return ScriptBase::Rand(); } @@ -29,7 +29,7 @@ return ScriptObject::GetRandomizer().Next(max); } -/* static */ SQInteger ScriptBase::RandRangeItem(SQInteger unused_param, SQInteger max) +/* static */ SQInteger ScriptBase::RandRangeItem(SQInteger, SQInteger max) { return ScriptBase::RandRange(max); } @@ -42,7 +42,7 @@ return ScriptBase::RandRange(max) < out; } -/* static */ bool ScriptBase::ChanceItem(SQInteger unused_param, SQInteger out, SQInteger max) +/* static */ bool ScriptBase::ChanceItem(SQInteger, SQInteger out, SQInteger max) { return ScriptBase::Chance(out, max); } diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index c528734191..5ffcdf699c 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -102,7 +102,7 @@ struct ScriptListWindow : public Window { SetDParam(0, (this->slot == OWNER_DEITY) ? STR_AI_LIST_CAPTION_GAMESCRIPT : STR_AI_LIST_CAPTION_AI); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_SCRL_LIST) return; @@ -184,7 +184,7 @@ struct ScriptListWindow : public Window { InvalidateWindowClassesData(WC_TEXTFILE); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SCRL_LIST: { // Select one of the Scripts @@ -222,7 +222,7 @@ struct ScriptListWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (_game_mode == GM_NORMAL && Company::IsValidID(this->slot)) { this->Close(); @@ -342,7 +342,7 @@ struct ScriptSettingsWindow : public Window { SetDParam(0, (this->slot == OWNER_DEITY) ? STR_AI_SETTINGS_CAPTION_GAMESCRIPT : STR_AI_SETTINGS_CAPTION_AI); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_SCRS_BACKGROUND) return; @@ -421,7 +421,7 @@ struct ScriptSettingsWindow : public Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SCRS_BACKGROUND: { @@ -530,7 +530,7 @@ struct ScriptSettingsWindow : public Window { SetValue(index); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. @@ -557,7 +557,7 @@ struct ScriptSettingsWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { this->RebuildVisibleSettings(); this->CloseChildWindows(WC_DROPDOWN_MENU); @@ -640,7 +640,7 @@ struct ScriptTextfileWindow : public TextfileWindow { } } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { auto textfile = GetConfig(slot)->GetTextfile(file_type, slot); if (!textfile.has_value()) { @@ -788,7 +788,7 @@ struct ScriptDebugWindow : public Window { this->InvalidateData(-1); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget == WID_SCRD_LOG_PANEL) { resize->height = FONT_HEIGHT_NORMAL + WidgetDimensions::scaled.vsep_normal; @@ -948,7 +948,7 @@ struct ScriptDebugWindow : public Window { this->last_vscroll_pos = this->vscroll->GetPosition(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { /* Also called for hotkeys, so check for disabledness */ if (this->IsWidgetDisabled(widget)) return; @@ -1032,7 +1032,7 @@ struct ScriptDebugWindow : public Window { * This is the company ID of the AI/GS which wrote a new log message, or -1 in other cases. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { /* If the log message is related to the active company tab, check the break string. * This needs to be done in gameloop-scope, so the AI is suspended immediately. */ diff --git a/src/script/script_scanner.cpp b/src/script/script_scanner.cpp index 52625c6515..ff85007ce9 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -23,7 +23,7 @@ #include "../safeguards.h" -bool ScriptScanner::AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) +bool ScriptScanner::AddFile(const std::string &filename, size_t, const std::string &tar_filename) { this->main_script = filename; this->tar_file = tar_filename; @@ -161,7 +161,7 @@ struct ScriptFileChecksumCreator : FileScanner { ScriptFileChecksumCreator(Subdirectory dir) : dir(dir) {} /* Add the file and calculate the md5 sum. */ - virtual bool AddFile(const std::string &filename, size_t basepath_length, const std::string &tar_filename) + bool AddFile(const std::string &filename, size_t, const std::string &) override { Md5 checksum; uint8_t buffer[1024]; diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 4bcccbf60a..ba22fc881a 100644 --- a/src/script/squirrel_helper.hpp +++ b/src/script/squirrel_helper.hpp @@ -131,7 +131,7 @@ namespace SQConvert { private: template - static int SQCall(void *instance, Tretval(*func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence) + static int SQCall(void *, Tretval(*func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence) { if constexpr (std::is_void_v) { (*func)( @@ -180,7 +180,7 @@ namespace SQConvert { } template - static Tcls *SQConstruct(Tcls *, Tretval(Tcls:: *func)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence) + static Tcls *SQConstruct(Tcls *, Tretval(Tcls:: *)(Targs...), [[maybe_unused]] HSQUIRRELVM vm, std::index_sequence) { Tcls *inst = new Tcls( Param::Get(vm, 2 + i)... @@ -321,7 +321,7 @@ namespace SQConvert { * here as it has to be in the same scope as DefSQConstructorCallback. */ template - static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger size) + static SQInteger DefSQDestructorCallback(SQUserPointer p, SQInteger) { /* Remove the real instance too */ if (p != nullptr) ((Tcls *)p)->Release(); diff --git a/src/settings.cpp b/src/settings.cpp index 42c2fe0d2d..a7a4d1a7c0 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -754,13 +754,13 @@ bool StringSettingDesc::IsDefaultValue(void *object) const return this->def == str; } -bool ListSettingDesc::IsSameValue(const IniItem *item, void *object) const +bool ListSettingDesc::IsSameValue(const IniItem *, void *) const { /* Checking for equality is way more expensive than just writing the value. */ return false; } -bool ListSettingDesc::IsDefaultValue(void *object) const +bool ListSettingDesc::IsDefaultValue(void *) const { /* Defaults of lists are often complicated, and hard to compare. */ return false; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 319e2faf9b..e6fba68826 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -432,7 +432,7 @@ struct GameOptionsWindow : Window { if (changed) this->ReInit(0, 0, this->flags & WF_CENTERED); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_GO_BASE_GRF_STATUS: @@ -483,7 +483,7 @@ struct GameOptionsWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_GO_BASE_GRF_TEXTFILE && widget < WID_GO_BASE_GRF_TEXTFILE + TFT_CONTENT_END) { if (BaseGraphics::GetUsedSet() == nullptr) return; @@ -728,7 +728,7 @@ struct GameOptionsWindow : Window { * @param data Information about the changed data. @see GameOptionsInvalidationData * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->SetWidgetLoweredState(WID_GO_SURVEY_PARTICIPATE_BUTTON, _settings_client.network.participate_survey == PS_YES); @@ -990,10 +990,10 @@ struct BaseSettingEntry { void SetLastField(bool last_field) { if (last_field) SETBITS(this->flags, SEF_LAST_FIELD); else CLRBITS(this->flags, SEF_LAST_FIELD); } virtual uint Length() const = 0; - virtual void GetFoldingState(bool &all_folded, bool &all_unfolded) const {} + virtual void GetFoldingState([[maybe_unused]] bool &all_folded, [[maybe_unused]] bool &all_unfolded) const {} virtual bool IsVisible(const BaseSettingEntry *item) const; virtual BaseSettingEntry *FindEntry(uint row, uint *cur_row); - virtual uint GetMaxHelpHeight(int maxw) { return 0; } + virtual uint GetMaxHelpHeight([[maybe_unused]] int maxw) { return 0; } /** * Check whether an entry is hidden due to filters @@ -1714,13 +1714,11 @@ uint SettingsPage::Draw(GameSettings *settings_ptr, int left, int right, int y, /** * Function to draw setting value (button + text + current value) - * @param settings_ptr Pointer to current values of all settings * @param left Left-most position in window/panel to start drawing * @param right Right-most position in window/panel to draw * @param y Upper-most position in window/panel to start drawing - * @param highlight Highlight entry. */ -void SettingsPage::DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const +void SettingsPage::DrawSetting(GameSettings *, int left, int right, int y, bool) const { bool rtl = _current_text_dir == TD_RTL; DrawSprite((this->folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED), PAL_NONE, rtl ? right - _circle_size.width : left, y + (SETTING_HEIGHT - _circle_size.height) / 2); @@ -2125,7 +2123,7 @@ struct GameSettingsWindow : Window { _circle_size = maxdim(GetSpriteSize(SPR_CIRCLE_FOLDED), GetSpriteSize(SPR_CIRCLE_UNFOLDED)); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_GS_OPTIONSPANEL: @@ -2285,7 +2283,7 @@ struct GameSettingsWindow : Window { this->last_clicked = pe; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_GS_EXPAND_ALL: @@ -2561,7 +2559,7 @@ struct GameSettingsWindow : Window { } } - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -2772,7 +2770,7 @@ struct CustomCurrencyWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { /* Set the appropriate width for the edit 'buttons' */ @@ -2791,7 +2789,7 @@ struct CustomCurrencyWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { int line = 0; int len = 0; diff --git a/src/settings_internal.h b/src/settings_internal.h index 9c791cb0c5..7980ebae03 100644 --- a/src/settings_internal.h +++ b/src/settings_internal.h @@ -342,10 +342,10 @@ struct NullSettingDesc : SettingDesc { NullSettingDesc(const SaveLoad &save) : SettingDesc(save, SF_NOT_IN_CONFIG, false) {} - std::string FormatValue(const void *object) const override { NOT_REACHED(); } - void ParseValue(const IniItem *item, void *object) const override { NOT_REACHED(); } - bool IsSameValue(const IniItem *item, void *object) const override { NOT_REACHED(); } - bool IsDefaultValue(void *object) const override { NOT_REACHED(); } + std::string FormatValue(const void *) const override { NOT_REACHED(); } + void ParseValue(const IniItem *, void *) const override { NOT_REACHED(); } + bool IsSameValue(const IniItem *, void *) const override { NOT_REACHED(); } + bool IsDefaultValue(void *) const override { NOT_REACHED(); } }; typedef std::variant SettingVariant; diff --git a/src/settings_table.cpp b/src/settings_table.cpp index 29fe6c09e2..44d8189ca1 100644 --- a/src/settings_table.cpp +++ b/src/settings_table.cpp @@ -79,13 +79,13 @@ SettingTable _win32_settings{ _win32_settings_table }; /* Begin - Callback Functions for the various settings. */ /** Reposition the main toolbar as the setting changed. */ -static void v_PositionMainToolbar(int32_t new_value) +static void v_PositionMainToolbar(int32_t) { if (_game_mode != GM_MENU) PositionMainToolbar(nullptr); } /** Reposition the statusbar as the setting changed. */ -static void v_PositionStatusbar(int32_t new_value) +static void v_PositionStatusbar(int32_t) { if (_game_mode != GM_MENU) { PositionStatusbar(nullptr); @@ -96,9 +96,8 @@ static void v_PositionStatusbar(int32_t new_value) /** * Redraw the smallmap after a colour scheme change. - * @param new_value Callback parameter. */ -static void RedrawSmallmap(int32_t new_value) +static void RedrawSmallmap(int32_t) { BuildLandLegend(); BuildOwnerLegend(); @@ -106,19 +105,19 @@ static void RedrawSmallmap(int32_t new_value) } /** Redraw linkgraph links after a colour scheme change. */ -static void UpdateLinkgraphColours(int32_t new_value) +static void UpdateLinkgraphColours(int32_t) { BuildLinkStatsLegend(); MarkWholeScreenDirty(); } -static void StationSpreadChanged(int32_t new_value) +static void StationSpreadChanged(int32_t) { InvalidateWindowData(WC_SELECT_STATION, 0); InvalidateWindowData(WC_BUILD_STATION, 0); } -static void UpdateConsists(int32_t new_value) +static void UpdateConsists(int32_t) { for (Train *t : Train::Iterate()) { /* Update the consist of all trains so the maximum speed is set correctly. */ @@ -170,7 +169,7 @@ static void UpdateAllServiceInterval(int32_t new_value) SetWindowClassesDirty(WC_VEHICLE_DETAILS); } -static bool CanUpdateServiceInterval(VehicleType type, int32_t &new_value) +static bool CanUpdateServiceInterval(VehicleType, int32_t &new_value) { VehicleDefaultSettings *vds; if (_game_mode == GM_MENU || !Company::IsValidID(_current_company)) { @@ -197,7 +196,7 @@ static void UpdateServiceInterval(VehicleType type, int32_t new_value) SetWindowClassesDirty(WC_VEHICLE_DETAILS); } -static void TrainAccelerationModelChanged(int32_t new_value) +static void TrainAccelerationModelChanged(int32_t) { for (Train *t : Train::Iterate()) { if (t->IsFrontEngine()) { @@ -214,9 +213,8 @@ static void TrainAccelerationModelChanged(int32_t new_value) /** * This function updates the train acceleration cache after a steepness change. - * @param new_value Unused new value of setting. */ -static void TrainSlopeSteepnessChanged(int32_t new_value) +static void TrainSlopeSteepnessChanged(int32_t) { for (Train *t : Train::Iterate()) { if (t->IsFrontEngine()) t->CargoChanged(); @@ -225,9 +223,8 @@ static void TrainSlopeSteepnessChanged(int32_t new_value) /** * This function updates realistic acceleration caches when the setting "Road vehicle acceleration model" is set. - * @param new_value Unused new value of setting. */ -static void RoadVehAccelerationModelChanged(int32_t new_value) +static void RoadVehAccelerationModelChanged(int32_t) { if (_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) { for (RoadVehicle *rv : RoadVehicle::Iterate()) { @@ -245,16 +242,15 @@ static void RoadVehAccelerationModelChanged(int32_t new_value) /** * This function updates the road vehicle acceleration cache after a steepness change. - * @param new_value Unused new value of setting. */ -static void RoadVehSlopeSteepnessChanged(int32_t new_value) +static void RoadVehSlopeSteepnessChanged(int32_t) { for (RoadVehicle *rv : RoadVehicle::Iterate()) { if (rv->IsFrontEngine()) rv->CargoChanged(); } } -static void TownFoundingChanged(int32_t new_value) +static void TownFoundingChanged(int32_t) { if (_game_mode != GM_EDITOR && _settings_game.economy.found_town == TF_FORBIDDEN) { CloseWindowById(WC_FOUND_TOWN, 0); @@ -263,7 +259,7 @@ static void TownFoundingChanged(int32_t new_value) } } -static void ZoomMinMaxChanged(int32_t new_value) +static void ZoomMinMaxChanged(int32_t) { ConstrainAllViewportsZoom(); GfxClearSpriteCache(); @@ -275,7 +271,7 @@ static void ZoomMinMaxChanged(int32_t new_value) } } -static void SpriteZoomMinChanged(int32_t new_value) +static void SpriteZoomMinChanged(int32_t) { GfxClearSpriteCache(); /* Force all sprites to redraw at the new chosen zoom level */ @@ -286,22 +282,21 @@ static void SpriteZoomMinChanged(int32_t new_value) * Update any possible saveload window and delete any newgrf dialogue as * its widget parts might change. Reinit all windows as it allows access to the * newgrf debug button. - * @param new_value unused. */ -static void InvalidateNewGRFChangeWindows(int32_t new_value) +static void InvalidateNewGRFChangeWindows(int32_t) { InvalidateWindowClassesData(WC_SAVELOAD); CloseWindowByClass(WC_GAME_OPTIONS); ReInitAllWindows(false); } -static void InvalidateCompanyLiveryWindow(int32_t new_value) +static void InvalidateCompanyLiveryWindow(int32_t) { InvalidateWindowClassesData(WC_COMPANY_COLOUR, -1); ResetVehicleColourMap(); } -static void DifficultyNoiseChange(int32_t new_value) +static void DifficultyNoiseChange(int32_t) { if (_game_mode == GM_NORMAL) { UpdateAirportsNoise(); @@ -311,7 +306,7 @@ static void DifficultyNoiseChange(int32_t new_value) } } -static void MaxNoAIsChange(int32_t new_value) +static void MaxNoAIsChange(int32_t) { if (GetGameSettings().difficulty.max_no_competitors != 0 && AI::GetInfoList()->size() == 0 && @@ -324,10 +319,9 @@ static void MaxNoAIsChange(int32_t new_value) /** * Check whether the road side may be changed. - * @param new_value unused * @return true if the road side may be changed. */ -static bool CheckRoadSide(int32_t &new_value) +static bool CheckRoadSide(int32_t &) { return _game_mode == GM_MENU || !RoadVehiclesAreBuilt(); } @@ -418,7 +412,7 @@ static void UpdateFreeformEdges(int32_t new_value) * Changing the setting "allow multiple NewGRF sets" is not allowed * if there are vehicles. */ -static bool CheckDynamicEngines(int32_t &new_value) +static bool CheckDynamicEngines(int32_t &) { if (_game_mode == GM_MENU) return true; @@ -448,19 +442,19 @@ static bool CheckMaxHeightLevel(int32_t &new_value) return true; } -static void StationCatchmentChanged(int32_t new_value) +static void StationCatchmentChanged(int32_t) { Station::RecomputeCatchmentForAll(); MarkWholeScreenDirty(); } -static void MaxVehiclesChanged(int32_t new_value) +static void MaxVehiclesChanged(int32_t) { InvalidateWindowClassesData(WC_BUILD_TOOLBAR); MarkWholeScreenDirty(); } -static void InvalidateShipPathCache(int32_t new_value) +static void InvalidateShipPathCache(int32_t) { for (Ship *s : Ship::Iterate()) { s->path.clear(); diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index a160205d22..cf1a2bb4e6 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -159,7 +159,7 @@ struct SettingsIniFile : IniLoadFile { { } - virtual FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size) + virtual FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) { /* Open the text file in binary mode to prevent end-of-line translations * done by ftell() and friends, as defined by K&R. */ diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 7f07233a61..cab94cf334 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -325,7 +325,7 @@ void Ship::UpdateDeltaXY() /** * Test-procedure for HasVehicleOnPos to check for any ships which are visible and not stopped by the player. */ -static Vehicle *EnsureNoMovingShipProc(Vehicle *v, void *data) +static Vehicle *EnsureNoMovingShipProc(Vehicle *v, void *) { return v->type == VEH_SHIP && (v->vehstatus & (VS_HIDDEN | VS_STOPPED)) == 0 ? v : nullptr; } diff --git a/src/signs_cmd.cpp b/src/signs_cmd.cpp index 139d874c6c..b53a843caa 100644 --- a/src/signs_cmd.cpp +++ b/src/signs_cmd.cpp @@ -102,11 +102,10 @@ CommandCost CmdRenameSign(DoCommandFlag flags, SignID sign_id, const std::string /** * Callback function that is called after a sign is placed - * @param cmd unused * @param result of the operation * @param new_sign ID of the placed sign. */ -void CcPlaceSign(Commands cmd, const CommandCost &result, SignID new_sign) +void CcPlaceSign(Commands, const CommandCost &result, SignID new_sign) { if (result.Failed()) return; diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index e3c9cd84ea..c45483168a 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -104,14 +104,14 @@ struct SignList { } /** Filter sign list excluding OWNER_DEITY */ - static bool CDECL OwnerDeityFilter(const Sign * const *a, StringFilter &filter) + static bool CDECL OwnerDeityFilter(const Sign * const *a, StringFilter &) { /* You should never be able to edit signs of owner DEITY */ return (*a)->owner != OWNER_DEITY; } /** Filter sign list by owner */ - static bool CDECL OwnerVisibilityFilter(const Sign * const *a, StringFilter &filter) + static bool CDECL OwnerVisibilityFilter(const Sign * const *a, StringFilter &) { assert(!HasBit(_display_opt, DO_SHOW_COMPETITOR_SIGNS)); /* Hide sign if non-own signs are hidden in the viewport */ @@ -231,7 +231,7 @@ struct SignListWindow : Window, SignList { if (widget == WID_SIL_CAPTION) SetDParam(0, this->vscroll->GetCount()); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SIL_LIST: { @@ -263,7 +263,7 @@ struct SignListWindow : Window, SignList { this->vscroll->SetCapacityFromWidget(this, WID_SIL_LIST, WidgetDimensions::scaled.framerect.Vertical()); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SIL_LIST: { @@ -325,7 +325,7 @@ struct SignListWindow : Window, SignList { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { /* When there is a filter string, we always need to rebuild the list even if * the amount of signs in total is unchanged, as the subset of signs that is @@ -485,7 +485,7 @@ struct SignWindow : Window, SignList { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_QES_LOCATION: { diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 4e17c1f55d..aed4abd03e 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -424,7 +424,7 @@ static inline uint32_t GetSmallMapContoursPixels(TileIndex tile, TileType t) * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Vehicles" */ -static inline uint32_t GetSmallMapVehiclesPixels(TileIndex tile, TileType t) +static inline uint32_t GetSmallMapVehiclesPixels(TileIndex, TileType t) { const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; return ApplyMask(cs->default_colour, &_smallmap_vehicles_andor[t]); @@ -1404,7 +1404,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) return (column * number_of_rows) + line; } -/* virtual */ void SmallMapWindow::OnMouseOver(Point pt, int widget) +/* virtual */ void SmallMapWindow::OnMouseOver([[maybe_unused]] Point pt, int widget) { IndustryType new_highlight = INVALID_INDUSTRYTYPE; if (widget == WID_SM_LEGEND && this->map_type == SMT_INDUSTRY) { @@ -1420,7 +1420,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) } } -/* virtual */ void SmallMapWindow::OnClick(Point pt, int widget, int click_count) +/* virtual */ void SmallMapWindow::OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) { switch (widget) { case WID_SM_MAP: { // Map window @@ -1565,7 +1565,7 @@ int SmallMapWindow::GetPositionOnLegend(Point pt) this->SetDirty(); } -/* virtual */ bool SmallMapWindow::OnRightClick(Point pt, int widget) +/* virtual */ bool SmallMapWindow::OnRightClick([[maybe_unused]] Point pt, int widget) { if (widget != WID_SM_MAP || _scrolling_viewport) return false; diff --git a/src/smallmap_gui.h b/src/smallmap_gui.h index f86fbe9948..5aa8cb34eb 100644 --- a/src/smallmap_gui.h +++ b/src/smallmap_gui.h @@ -204,12 +204,12 @@ public: void OnInit() override; void OnPaint() override; void DrawWidget(const Rect &r, int widget) const override; - void OnClick(Point pt, int widget, int click_count) override; + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override; void OnInvalidateData(int data = 0, bool gui_scope = true) override; bool OnRightClick(Point pt, int widget) override; void OnMouseWheel(int wheel) override; void OnScroll(Point delta) override; - void OnMouseOver(Point pt, int widget) override; + void OnMouseOver([[maybe_unused]] Point pt, int widget) override; }; #endif /* SMALLMAP_GUI_H */ diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp index 628ac06849..f059384181 100644 --- a/src/sound/cocoa_s.cpp +++ b/src/sound/cocoa_s.cpp @@ -36,7 +36,7 @@ static FSoundDriver_Cocoa iFSoundDriver_Cocoa; static AudioUnit _outputAudioUnit; /* The CoreAudio callback */ -static OSStatus audioCallback(void *inRefCon, AudioUnitRenderActionFlags *inActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * ioData) +static OSStatus audioCallback(void *, AudioUnitRenderActionFlags *, const AudioTimeStamp *, UInt32, UInt32, AudioBufferList *ioData) { MxMixSamples(ioData->mBuffers[0].mData, ioData->mBuffers[0].mDataByteSize / 4); diff --git a/src/sound/null_s.h b/src/sound/null_s.h index 9bc660b92d..ca699da236 100644 --- a/src/sound/null_s.h +++ b/src/sound/null_s.h @@ -15,7 +15,7 @@ /** Implementation of the null sound driver. */ class SoundDriver_Null : public SoundDriver { public: - const char *Start(const StringList ¶m) override { return nullptr; } + const char *Start(const StringList &) override { return nullptr; } void Stop() override { } const char *GetName() const override { return "null"; } diff --git a/src/sound/sdl2_s.cpp b/src/sound/sdl2_s.cpp index 9d1e47fabb..0a49ad0297 100644 --- a/src/sound/sdl2_s.cpp +++ b/src/sound/sdl2_s.cpp @@ -22,11 +22,10 @@ static FSoundDriver_SDL iFSoundDriver_SDL; /** * Callback that fills the sound buffer. - * @param userdata Ignored. * @param stream The stream to put data into. * @param len The length of the stream in bytes. */ -static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) +static void CDECL fill_sound_buffer(void *, Uint8 *stream, int len) { MxMixSamples(stream, len / 4); } diff --git a/src/sound/sdl_s.cpp b/src/sound/sdl_s.cpp index 737192a7ed..4aeaa35b26 100644 --- a/src/sound/sdl_s.cpp +++ b/src/sound/sdl_s.cpp @@ -22,11 +22,10 @@ static FSoundDriver_SDL iFSoundDriver_SDL; /** * Callback that fills the sound buffer. - * @param userdata Ignored. * @param stream The stream to put data into. * @param len The length of the stream in bytes. */ -static void CDECL fill_sound_buffer(void *userdata, Uint8 *stream, int len) +static void CDECL fill_sound_buffer(void *, Uint8 *stream, int len) { MxMixSamples(stream, len / 4); } diff --git a/src/sound/win32_s.cpp b/src/sound/win32_s.cpp index f9fda5a349..b7220b7786 100644 --- a/src/sound/win32_s.cpp +++ b/src/sound/win32_s.cpp @@ -40,7 +40,7 @@ static void PrepareHeader(WAVEHDR *hdr) if (waveOutPrepareHeader(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR) throw "waveOutPrepareHeader failed"; } -static DWORD WINAPI SoundThread(LPVOID arg) +static DWORD WINAPI SoundThread(LPVOID) { SetCurrentThreadName("ottd:win-sound"); diff --git a/src/station.cpp b/src/station.cpp index 85bbc09f1a..76b1c7d3ac 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -162,9 +162,8 @@ Station::~Station() /** * Invalidating of the JoinStation window has to be done * after removing item from the pool. - * @param index index of deleted item */ -void BaseStation::PostDestructor(size_t index) +void BaseStation::PostDestructor(size_t) { InvalidateWindowData(WC_SELECT_STATION, 0, 0); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index e9761afd81..33aa52f5da 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -3259,12 +3259,12 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro DrawRailTileSeqInGUI(x, y, t, st == STATION_WAYPOINT ? 0 : total_offset, 0, pal); } -static int GetSlopePixelZ_Station(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Station(TileIndex tile, uint, uint, bool) { return GetTileMaxPixelZ(tile); } -static Foundation GetFoundation_Station(TileIndex tile, Slope tileh) +static Foundation GetFoundation_Station(TileIndex, Slope tileh) { return FlatteningFoundation(tileh); } @@ -4137,7 +4137,7 @@ const StationList *StationFinder::GetStations() assert(this->w == 1 && this->h == 1); AddNearbyStationsByCatchment(this->tile, &this->stations, Town::GetByTile(this->tile)->stations_near); } else { - ForAllStationsAroundTiles(*this, [this](Station *st, TileIndex tile) { + ForAllStationsAroundTiles(*this, [this](Station *st, TileIndex) { this->stations.insert(st); return true; }); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 87f64167f5..d05a3aeeb6 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -142,7 +142,7 @@ void CheckRedrawStationCoverage(const Window *w) } } -void CheckRedrawWaypointCoverage(const Window *w) +void CheckRedrawWaypointCoverage(const Window *) { /* Test if ctrl state changed */ static bool _last_ctrl_pressed; @@ -385,7 +385,7 @@ public: this->last_sorting = this->stations.GetListing(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_STL_SORTBY: { @@ -521,7 +521,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_STL_LIST: { @@ -666,7 +666,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == 0) { /* This needs to be done in command-scope to enforce rebuilding before resorting invalid data */ @@ -1380,7 +1380,7 @@ struct StationViewWindow : public Window { data->Update(count); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_SV_WAITING: @@ -1910,7 +1910,7 @@ struct StationViewWindow : public Window { this->SetWidgetDirty(WID_SV_WAITING); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SV_WAITING: @@ -2101,7 +2101,7 @@ struct StationViewWindow : public Window { * @param data Information about the changed data. If it's a valid cargo ID, invalidate the cargo data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (gui_scope) { if (data >= 0 && data < NUM_CARGO) { @@ -2295,7 +2295,7 @@ struct SelectStationWindow : Window { this->Window::Close(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_JS_PANEL) return; @@ -2334,7 +2334,7 @@ struct SelectStationWindow : Window { } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget != WID_JS_PANEL) return; @@ -2348,7 +2348,7 @@ struct SelectStationWindow : Window { CloseWindowById(WC_SELECT_STATION, 0); } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { if (_thd.dirty & 2) { _thd.dirty &= ~2; @@ -2366,7 +2366,7 @@ struct SelectStationWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; FindStationsNearby(this->area, true); @@ -2374,7 +2374,7 @@ struct SelectStationWindow : Window { this->SetDirty(); } - void OnMouseOver(Point pt, int widget) override + void OnMouseOver([[maybe_unused]] Point pt, int widget) override { if (widget != WID_JS_PANEL) { SetViewportCatchmentSpecializedStation(nullptr, true); diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 2719fef18d..b1ac784e24 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -72,18 +72,18 @@ struct StatusBarWindow : Window { PositionStatusbar(this); } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = { 0, _screen.height - sm_height }; return pt; } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { Dimension d; switch (widget) { @@ -174,7 +174,7 @@ struct StatusBarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; switch (data) { @@ -190,7 +190,7 @@ struct StatusBarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_S_MIDDLE: ShowLastNewsMessage(); break; diff --git a/src/story_gui.cpp b/src/story_gui.cpp index b9c6a29b5c..03324fca8b 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -751,7 +751,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_SB_SEL_PAGE && widget != WID_SB_PAGE_PANEL) return; @@ -801,7 +801,7 @@ public: this->vscroll->SetCount(this->GetContentHeight()); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_SB_SEL_PAGE: { @@ -857,7 +857,7 @@ public: * >= 0 Id of the page that needs to be refreshed. If it is not the current page, nothing happens. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -898,7 +898,7 @@ public: this->SetWidgetDirty(WID_SB_PAGE_PANEL); } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { const StoryPageElement *const pe = StoryPageElement::GetIfValid(this->active_button_id); if (pe == nullptr || pe->type != SPET_BUTTON_TILE) { diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp index 1913b1925a..fc5e471f90 100644 --- a/src/strgen/strgen_base.cpp +++ b/src/strgen/strgen_base.cpp @@ -325,7 +325,7 @@ static void EmitWordList(Buffer *buffer, const std::vector &words, } } -void EmitPlural(Buffer *buffer, char *buf, int value) +void EmitPlural(Buffer *buffer, char *buf, int) { int argidx = _cur_argidx; int offset = -1; @@ -378,7 +378,7 @@ void EmitPlural(Buffer *buffer, char *buf, int value) } -void EmitGender(Buffer *buffer, char *buf, int value) +void EmitGender(Buffer *buffer, char *buf, int) { int argidx = _cur_argidx; int offset = 0; @@ -531,7 +531,7 @@ StringReader::StringReader(StringData &data, const std::string &file, bool maste { } -ParsedCommandStruct ExtractCommandString(const char *s, bool warnings) +ParsedCommandStruct ExtractCommandString(const char *s, bool) { char param[MAX_COMMAND_PARAM_SIZE]; int argno; diff --git a/src/strings.cpp b/src/strings.cpp index 959d68dfd5..8b777a79be 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2170,7 +2170,7 @@ class LanguagePackGlyphSearcher : public MissingGlyphSearcher { return false; } - void SetFontNames(FontCacheSettings *settings, const char *font_name, const void *os_data) override + void SetFontNames([[maybe_unused]] FontCacheSettings *settings, [[maybe_unused]] const char *font_name, [[maybe_unused]] const void *os_data) override { #if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA) settings->small.font = font_name; diff --git a/src/subsidy_gui.cpp b/src/subsidy_gui.cpp index ff6efbc651..3074431e8f 100644 --- a/src/subsidy_gui.cpp +++ b/src/subsidy_gui.cpp @@ -36,7 +36,7 @@ struct SubsidyListWindow : Window { this->OnInvalidateData(0); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget != WID_SUL_PANEL) return; @@ -125,7 +125,7 @@ struct SubsidyListWindow : Window { return 3 + num_awarded + num_not_awarded; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_SUL_PANEL) return; Dimension d = maxdim(GetStringBoundingBox(STR_SUBSIDIES_OFFERED_TITLE), GetStringBoundingBox(STR_SUBSIDIES_SUBSIDISED_TITLE)); @@ -210,7 +210,7 @@ struct SubsidyListWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->vscroll->SetCount(this->CountLines()); diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 7427a5ecc1..2c92db398c 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -137,7 +137,7 @@ static const NIVariable _niv_stations[] = { class NIHStation : public NIHelper { bool IsInspectable(uint index) const override { return GetStationSpec(index) != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::GetByTile(index)->town->index); } - const void *GetInstance(uint index)const override { return nullptr; } + const void *GetInstance(uint ) const override { return nullptr; } const void *GetSpec(uint index) const override { return GetStationSpec(index); } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); } uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetStationSpec(index)->grf_prop.grffile->grfid : 0; } @@ -202,7 +202,7 @@ static const NIVariable _niv_house[] = { class NIHHouse : public NIHelper { bool IsInspectable(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, GetTownIndex(index)); } - const void *GetInstance(uint index)const override { return nullptr; } + const void *GetInstance(uint)const override { return nullptr; } const void *GetSpec(uint index) const override { return HouseSpec::Get(GetHouseType(index)); } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_TOWN_NAME, GetTownIndex(index), index); } uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grffile->grfid : 0; } @@ -252,7 +252,7 @@ static const NIVariable _niv_industrytiles[] = { class NIHIndustryTile : public NIHelper { bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_INDUSTRIES, GetIndustryIndex(index)); } - const void *GetInstance(uint index)const override { return nullptr; } + const void *GetInstance(uint)const override { return nullptr; } const void *GetSpec(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index)); } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_INDUSTRY_NAME, GetIndustryIndex(index), index); } uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; } @@ -372,9 +372,9 @@ class NIHIndustry : public NIHelper { return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail); } - uint GetPSASize(uint index, uint32_t grfid) const override { return cpp_lengthof(PersistentStorage, storage); } + uint GetPSASize(uint, uint32_t) const override { return cpp_lengthof(PersistentStorage, storage); } - const int32_t *GetPSAFirstPosition(uint index, uint32_t grfid) const override + const int32_t *GetPSAFirstPosition(uint index, uint32_t) const override { const Industry *i = (const Industry *)this->GetInstance(index); if (i->psa == nullptr) return nullptr; @@ -457,12 +457,12 @@ static const NIVariable _niv_railtypes[] = { }; class NIHRailType : public NIHelper { - bool IsInspectable(uint index) const override { return true; } - uint GetParent(uint index) const override { return UINT32_MAX; } - const void *GetInstance(uint index)const override { return nullptr; } - const void *GetSpec(uint index) const override { return nullptr; } + bool IsInspectable(uint) const override { return true; } + uint GetParent(uint) const override { return UINT32_MAX; } + const void *GetInstance(uint) const override { return nullptr; } + const void *GetSpec(uint) const override { return nullptr; } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); } - uint32_t GetGRFID(uint index) const override { return 0; } + uint32_t GetGRFID(uint) const override { return 0; } uint Resolve(uint index, uint var, uint param, bool *avail) const override { @@ -495,7 +495,7 @@ static const NICallback _nic_airporttiles[] = { class NIHAirportTile : public NIHelper { bool IsInspectable(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_AIRPORTS, GetStationIndex(index)); } - const void *GetInstance(uint index)const override { return nullptr; } + const void *GetInstance(uint)const override { return nullptr; } const void *GetSpec(uint index) const override { return AirportTileSpec::Get(GetAirportGfx(index)); } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); } uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile->grfid : 0; } @@ -548,9 +548,9 @@ class NIHAiport : public NIHelper { return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, avail); } - uint GetPSASize(uint index, uint32_t grfid) const override { return cpp_lengthof(PersistentStorage, storage); } + uint GetPSASize(uint, uint32_t) const override { return cpp_lengthof(PersistentStorage, storage); } - const int32_t *GetPSAFirstPosition(uint index, uint32_t grfid) const override + const int32_t *GetPSAFirstPosition(uint index, uint32_t) const override { const Station *st = (const Station *)this->GetInstance(index); if (st->airport.psa == nullptr) return nullptr; @@ -583,13 +583,13 @@ static const NIVariable _niv_towns[] = { class NIHTown : public NIHelper { bool IsInspectable(uint index) const override { return Town::IsValidID(index); } - uint GetParent(uint index) const override { return UINT32_MAX; } + uint GetParent(uint) const override { return UINT32_MAX; } const void *GetInstance(uint index)const override { return Town::Get(index); } - const void *GetSpec(uint index) const override { return nullptr; } + const void *GetSpec(uint) const override { return nullptr; } void SetStringParameters(uint index) const override { this->SetSimpleStringParameters(STR_TOWN_NAME, index); } - uint32_t GetGRFID(uint index) const override { return 0; } + uint32_t GetGRFID(uint) const override { return 0; } bool PSAWithParameter() const override { return true; } - uint GetPSASize(uint index, uint32_t grfid) const override { return cpp_lengthof(PersistentStorage, storage); } + uint GetPSASize(uint, uint32_t) const override { return cpp_lengthof(PersistentStorage, storage); } uint Resolve(uint index, uint var, uint param, bool *avail) const override { @@ -628,12 +628,12 @@ static const NIVariable _niv_roadtypes[] = { }; class NIHRoadType : public NIHelper { - bool IsInspectable(uint index) const override { return true; } - uint GetParent(uint index) const override { return UINT32_MAX; } - const void *GetInstance(uint index) const override { return nullptr; } - const void *GetSpec(uint index) const override { return nullptr; } + bool IsInspectable(uint) const override { return true; } + uint GetParent(uint) const override { return UINT32_MAX; } + const void *GetInstance(uint) const override { return nullptr; } + const void *GetSpec(uint) const override { return nullptr; } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); } - uint32_t GetGRFID(uint index) const override { return 0; } + uint32_t GetGRFID(uint) const override { return 0; } uint Resolve(uint index, uint var, uint param, bool *avail) const override { @@ -695,7 +695,7 @@ static const NIVariable _nif_roadstops[] = { class NIHRoadStop : public NIHelper { bool IsInspectable(uint index) const override { return GetRoadStopSpec(index) != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, BaseStation::GetByTile(index)->town->index); } - const void *GetInstance(uint index)const override { return nullptr; } + const void *GetInstance(uint)const override { return nullptr; } const void *GetSpec(uint index) const override { return GetRoadStopSpec(index); } void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_STATION_NAME, GetStationIndex(index), index); } uint32_t GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetRoadStopSpec(index)->grf_prop.grffile->grfid : 0; } diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index f68e675a11..f791c90852 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -44,7 +44,7 @@ #include "safeguards.h" -void CcTerraform(Commands cmd, const CommandCost &result, Money, TileIndex tile) +void CcTerraform(Commands, const CommandCost &result, Money, TileIndex tile) { if (result.Succeeded()) { if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_CONSTRUCTION_OTHER, tile); @@ -175,7 +175,7 @@ struct TerraformToolbarWindow : Window { show_object->SetDisplayedPlane(ObjectClass::GetUIClassCount() != 0 ? 0 : SZSP_NONE); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget < WID_TT_BUTTONS_START) return; @@ -222,7 +222,7 @@ struct TerraformToolbarWindow : Window { } } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_TT_LOWER_LAND: // Lower land button @@ -253,19 +253,19 @@ struct TerraformToolbarWindow : Window { } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = GetToolbarAlignedWindowPosition(sm_width); pt.y += sm_height; return pt; } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { @@ -500,10 +500,9 @@ static const NWidgetPart _nested_scen_edit_land_gen_widgets[] = { /** * Callback function for the scenario editor 'reset landscape' confirmation window - * @param w Window unused * @param confirmed boolean value, true when yes was clicked, false otherwise */ -static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) +static void ResetLandscapeConfirmationCallback(Window *, bool confirmed) { if (confirmed) { /* Set generating_world to true to get instant-green grass after removing @@ -554,7 +553,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget != WID_ETT_DOTS) return; @@ -579,7 +578,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } while (--n); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget < WID_ETT_BUTTONS_START) return; @@ -653,7 +652,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (this->last_user_action) { case WID_ETT_DEMOLISH: // Demolish aka dynamite button @@ -684,12 +683,12 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { VpSelectTilesWithMethod(pt.x, pt.y, select_method); } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (pt.x != -1) { switch (select_proc) { diff --git a/src/textfile_gui.cpp b/src/textfile_gui.cpp index 6eaf754dcb..54b7076210 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -126,7 +126,7 @@ uint TextfileWindow::GetContentHeight() return this->lines.back().bottom; } -/* virtual */ void TextfileWindow::UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) +/* virtual */ void TextfileWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) { switch (widget) { case WID_TF_BACKGROUND: @@ -516,7 +516,7 @@ void TextfileWindow::AfterLoadMarkdown() } } -/* virtual */ void TextfileWindow::OnClick(Point pt, int widget, int click_count) +/* virtual */ void TextfileWindow::OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) { switch (widget) { case WID_TF_WRAPTEXT: @@ -586,7 +586,7 @@ void TextfileWindow::AfterLoadMarkdown() this->SetupScrollbars(false); } -/* virtual */ void TextfileWindow::OnInvalidateData(int data, bool gui_scope) +/* virtual */ void TextfileWindow::OnInvalidateData([[maybe_unused]] int data, [[maybe_unused]] bool gui_scope) { if (!gui_scope) return; @@ -635,7 +635,7 @@ void TextfileWindow::ScrollToLine(size_t line) return true; } -/* virtual */ void TextfileWindow::SetFontNames(FontCacheSettings *settings, const char *font_name, const void *os_data) +/* virtual */ void TextfileWindow::SetFontNames([[maybe_unused]] FontCacheSettings *settings, [[maybe_unused]] const char *font_name, [[maybe_unused]] const void *os_data) { #if defined(WITH_FREETYPE) || defined(_WIN32) || defined(WITH_COCOA) settings->mono.font = font_name; diff --git a/src/textfile_gui.h b/src/textfile_gui.h index f4e61fe10e..119b0b6081 100644 --- a/src/textfile_gui.h +++ b/src/textfile_gui.h @@ -25,8 +25,8 @@ struct TextfileWindow : public Window, MissingGlyphSearcher { TextfileWindow(TextfileType file_type); - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override; - void OnClick(Point pt, int widget, int click_count) override; + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override; + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override; void DrawWidget(const Rect &r, int widget) const override; void OnResize() override; void OnInvalidateData(int data = 0, bool gui_scope = true) override; diff --git a/src/tgp.cpp b/src/tgp.cpp index f9337d5a42..5a66c69de8 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -439,7 +439,7 @@ static void HeightMapGetMinMaxAvg(Height *min_ptr, Height *max_ptr, Height *avg_ } /** Dill histogram and return pointer to its base point - to the count of zero heights */ -static int *HeightMapMakeHistogram(Height h_min, Height h_max, int *hist_buf) +static int *HeightMapMakeHistogram(Height h_min, [[maybe_unused]] Height h_max, int *hist_buf) { int *hist = hist_buf - h_min; diff --git a/src/timer/timer_game_calendar.cpp b/src/timer/timer_game_calendar.cpp index 7e3a47e0c4..e14d252b2e 100644 --- a/src/timer/timer_game_calendar.cpp +++ b/src/timer/timer_game_calendar.cpp @@ -182,7 +182,7 @@ void TimeoutTimer::Elapsed(TimerGameCalendar::TElapsed trigge } template<> -void TimerManager::Elapsed(TimerGameCalendar::TElapsed delta) +void TimerManager::Elapsed([[maybe_unused]] TimerGameCalendar::TElapsed delta) { assert(delta == 1); diff --git a/src/timer/timer_game_realtime.cpp b/src/timer/timer_game_realtime.cpp index 379924d139..f3aa7dac1d 100644 --- a/src/timer/timer_game_realtime.cpp +++ b/src/timer/timer_game_realtime.cpp @@ -63,7 +63,7 @@ void TimerManager::Elapsed(TimerGameRealtime::TElapsed delta) #ifdef WITH_ASSERT template<> -void TimerManager::Validate(TimerGameRealtime::TPeriod period) +void TimerManager::Validate(TimerGameRealtime::TPeriod) { } #endif /* WITH_ASSERT */ diff --git a/src/timer/timer_game_tick.cpp b/src/timer/timer_game_tick.cpp index 18203d7b75..ec68a0d8bb 100644 --- a/src/timer/timer_game_tick.cpp +++ b/src/timer/timer_game_tick.cpp @@ -62,7 +62,7 @@ void TimerManager::Elapsed(TimerGameTick::TElapsed delta) #ifdef WITH_ASSERT template<> -void TimerManager::Validate(TimerGameTick::TPeriod period) +void TimerManager::Validate(TimerGameTick::TPeriod) { } #endif /* WITH_ASSERT */ diff --git a/src/timer/timer_window.cpp b/src/timer/timer_window.cpp index f99d6372b3..dc6938af1b 100644 --- a/src/timer/timer_window.cpp +++ b/src/timer/timer_window.cpp @@ -61,7 +61,7 @@ void TimerManager::Elapsed(TimerWindow::TElapsed delta) #ifdef WITH_ASSERT template<> -void TimerManager::Validate(TimerWindow::TPeriod period) +void TimerManager::Validate(TimerWindow::TPeriod) { } #endif /* WITH_ASSERT */ diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 36d8bcb693..2f9b792c18 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -190,7 +190,7 @@ struct TimetableWindow : Window { return (travelling && v->lateness_counter < 0); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_VT_ARRIVAL_DEPARTURE_PANEL: @@ -210,7 +210,7 @@ struct TimetableWindow : Window { } } - int GetOrderFromTimetableWndPt(int y, const Vehicle *v) + int GetOrderFromTimetableWndPt(int y, [[maybe_unused]] const Vehicle *v) { int sel = this->vscroll->GetScrolledRowFromWidget(y, this, WID_VT_TIMETABLE_PANEL, WidgetDimensions::scaled.framerect.top); if (sel == INT_MAX) return INVALID_ORDER; @@ -223,7 +223,7 @@ struct TimetableWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { switch (data) { case VIWD_AUTOREPLACE: @@ -538,7 +538,7 @@ struct TimetableWindow : Window { return { order_number, mtf }; } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { const Vehicle *v = this->vehicle; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 0195a710cf..2f7c7191a2 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -108,7 +108,7 @@ public: return DropDownListStringItem::Width() + this->checkmark_width; } - void Draw(const Rect &r, bool sel, Colours bg_colour) const override + void Draw(const Rect &r, bool sel, Colours) const override { bool rtl = _current_text_dir == TD_RTL; Rect tr = r.Shrink(WidgetDimensions::scaled.dropdowntext, RectPadding::zero); @@ -147,12 +147,12 @@ public: return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_size.width + this->lock_size.width + WidgetDimensions::scaled.dropdowntext.Horizontal() + WidgetDimensions::scaled.hsep_wide; } - uint Height(uint width) const override + uint Height(uint) const override { return std::max(std::max(this->icon_size.height, this->lock_size.height) + WidgetDimensions::scaled.imgbtn.Vertical(), (uint)FONT_HEIGHT_NORMAL); } - void Draw(const Rect &r, bool sel, Colours bg_colour) const override + void Draw(const Rect &r, bool sel, Colours) const override { CompanyID company = (CompanyID)this->result; bool rtl = _current_text_dir == TD_RTL; @@ -270,7 +270,7 @@ static CallBackFunction SelectSignTool() /* --- Pausing --- */ -static CallBackFunction ToolbarPauseClick(Window *w) +static CallBackFunction ToolbarPauseClick(Window *) { if (_networking && !_network_server) return CBF_NONE; // only server can pause the game @@ -283,10 +283,9 @@ static CallBackFunction ToolbarPauseClick(Window *w) /** * Toggle fast forward mode. * - * @param w Unused. * @return #CBF_NONE */ -static CallBackFunction ToolbarFastForwardClick(Window *w) +static CallBackFunction ToolbarFastForwardClick(Window *) { if (_networking) return CBF_NONE; // no fast forward in network game @@ -551,10 +550,9 @@ static CallBackFunction ToolbarSubsidiesClick(Window *w) /** * Handle click on the entry in the Subsidies menu. * - * @param index Unused. * @return #CBF_NONE */ -static CallBackFunction MenuClickSubsidies(int index) +static CallBackFunction MenuClickSubsidies(int) { ShowSubsidiesList(); return CBF_NONE; @@ -985,10 +983,9 @@ static CallBackFunction ToolbarBuildWaterClick(Window *w) /** * Handle click on the entry in the Build Waterways menu. * - * @param index Unused. * @return #CBF_NONE */ -static CallBackFunction MenuClickBuildWater(int index) +static CallBackFunction MenuClickBuildWater(int) { ShowBuildDocksToolbar(); return CBF_NONE; @@ -1008,10 +1005,9 @@ static CallBackFunction ToolbarBuildAirClick(Window *w) /** * Handle click on the entry in the Build Air menu. * - * @param index Unused. * @return #CBF_NONE */ -static CallBackFunction MenuClickBuildAir(int index) +static CallBackFunction MenuClickBuildAir(int) { ShowBuildAirToolbar(); return CBF_NONE; @@ -1057,10 +1053,9 @@ static CallBackFunction ToolbarMusicClick(Window *w) /** * Handle click on the entry in the Music menu. * - * @param index Unused. * @return #CBF_NONE */ -static CallBackFunction MenuClickMusicWindow(int index) +static CallBackFunction MenuClickMusicWindow(int) { ShowMusicWindow(); return CBF_NONE; @@ -1321,7 +1316,7 @@ static CallBackFunction ToolbarScenPlaceSign(Window *w) return SelectSignTool(); } -static CallBackFunction ToolbarBtn_NULL(Window *w) +static CallBackFunction ToolbarBtn_NULL(Window *) { return CBF_NONE; } @@ -2009,7 +2004,7 @@ struct MainToolbarWindow : Window { DoZoomInOutWindow(ZOOM_NONE, this); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } @@ -2029,7 +2024,7 @@ struct MainToolbarWindow : Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (_game_mode != GM_MENU && !this->IsWidgetDisabled(widget)) _toolbar_button_procs[widget](this); } @@ -2090,7 +2085,7 @@ struct MainToolbarWindow : Window { return ES_HANDLED; } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (_last_started_action) { case CBF_PLACE_SIGN: @@ -2137,7 +2132,7 @@ struct MainToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; HandleZoomMessage(this, GetMainWindow()->viewport, WID_TN_ZOOM_IN, WID_TN_ZOOM_OUT); @@ -2349,7 +2344,7 @@ struct ScenarioEditorToolbarWindow : Window { DoZoomInOutWindow(ZOOM_NONE, this); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { Window::FindWindowPlacementAndResize(_toolbar_width, def_height); } @@ -2389,7 +2384,7 @@ struct ScenarioEditorToolbarWindow : Window { } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_TE_SPACER: @@ -2403,7 +2398,7 @@ struct ScenarioEditorToolbarWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (_game_mode == GM_MENU) return; CallBackFunction cbf = _scen_toolbar_button_procs[widget](this); @@ -2450,7 +2445,7 @@ struct ScenarioEditorToolbarWindow : Window { return ES_HANDLED; } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { switch (_last_started_action) { case CBF_PLACE_SIGN: @@ -2495,7 +2490,7 @@ struct ScenarioEditorToolbarWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; HandleZoomMessage(this, GetMainWindow()->viewport, WID_TE_ZOOM_IN, WID_TE_ZOOM_OUT); diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 8b17d4482d..cd912f28c7 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -155,9 +155,8 @@ Town::~Town() /** * Invalidating of the "nearest town cache" has to be done * after removing item from the pool. - * @param index index of deleted item */ -void Town::PostDestructor(size_t index) +void Town::PostDestructor(size_t) { InvalidateWindowData(WC_TOWN_DIRECTORY, 0, TDIWD_FORCE_REBUILD); UpdateNearestTownForRoadTiles(false); @@ -306,7 +305,7 @@ static void DrawTile_Town(TileInfo *ti) } } -static int GetSlopePixelZ_Town(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Town(TileIndex tile, uint, uint, bool) { return GetTileMaxPixelZ(tile); } @@ -800,13 +799,13 @@ static void GetTileDesc_Town(TileIndex tile, TileDesc *td) td->owner[0] = OWNER_TOWN; } -static TrackStatus GetTileTrackStatus_Town(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Town(TileIndex, TransportType, uint, DiagDirection) { /* not used */ return 0; } -static void ChangeTileOwner_Town(TileIndex tile, Owner old_owner, Owner new_owner) +static void ChangeTileOwner_Town(TileIndex, Owner, Owner) { /* not used */ } @@ -2159,9 +2158,8 @@ static bool FindFurthestFromWater(TileIndex tile, void *user_data) * CircularTileSearch callback; finds the nearest land tile * * @param tile Start looking from this tile - * @param user_data not used */ -static bool FindNearestEmptyLand(TileIndex tile, void *user_data) +static bool FindNearestEmptyLand(TileIndex tile, void *) { return IsTileType(tile, MP_CLEAR); } @@ -2358,7 +2356,7 @@ static void MakeTownHouse(TileIndex t, Town *town, byte counter, byte stage, Hou if (size & BUILDING_2_TILES_X) ClearMakeHouseTile(t + TileDiffXY(1, 0), town, counter, stage, ++type, random_bits); if (size & BUILDING_HAS_4_TILES) ClearMakeHouseTile(t + TileDiffXY(1, 1), town, counter, stage, ++type, random_bits); - ForAllStationsAroundTiles(TileArea(t, (size & BUILDING_2_TILES_X) ? 2 : 1, (size & BUILDING_2_TILES_Y) ? 2 : 1), [town](Station *st, TileIndex tile) { + ForAllStationsAroundTiles(TileArea(t, (size & BUILDING_2_TILES_X) ? 2 : 1, (size & BUILDING_2_TILES_Y) ? 2 : 1), [town](Station *st, TileIndex) { town->stations_near.insert(st); return true; }); diff --git a/src/town_gui.cpp b/src/town_gui.cpp index f66b0c7237..e2e76204d2 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -243,7 +243,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_TA_ACTION_INFO: { @@ -275,7 +275,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_TA_ZONE_BUTTON: { @@ -315,7 +315,7 @@ public: this->SetDirty(); }}; - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; @@ -475,7 +475,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_TV_CENTER_VIEW: // scroll to location @@ -518,7 +518,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_TV_INFO: @@ -583,7 +583,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* Called when setting station noise or required cargoes have changed, in order to resize the window */ @@ -868,7 +868,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_TD_SORT_ORDER: { @@ -920,7 +920,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_TD_SORT_ORDER: // Click on sort order button @@ -998,7 +998,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { switch (data) { case TDIWD_FORCE_REBUILD: @@ -1046,7 +1046,7 @@ void ShowTownDirectory() new TownDirectoryWindow(&_town_directory_desc); } -void CcFoundTown(Commands cmd, const CommandCost &result, TileIndex tile) +void CcFoundTown(Commands, const CommandCost &result, TileIndex tile) { if (result.Failed()) return; @@ -1054,7 +1054,7 @@ void CcFoundTown(Commands cmd, const CommandCost &result, TileIndex tile) if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace(); } -void CcFoundRandomTown(Commands cmd, const CommandCost &result, Money, TownID town_id) +void CcFoundRandomTown(Commands, const CommandCost &result, Money, TownID town_id) { if (result.Succeeded()) ScrollMainWindowToTile(Town::Get(town_id)->xy); } @@ -1208,7 +1208,7 @@ public: if (success && !_shift_pressed) this->RandomTownName(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_TF_NEW_TOWN: @@ -1260,7 +1260,7 @@ public: } } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { this->ExecuteFoundTownCommand(tile, false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown); } @@ -1276,7 +1276,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; this->UpdateButtons(true); diff --git a/src/train_gui.cpp b/src/train_gui.cpp index ebdfa29f0c..f8829688fd 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -22,12 +22,11 @@ /** * Callback for building wagons. - * @param cmd Unused. * @param result The result of the command. * @param new_veh_id ID of the ne vehicle. * @param tile The tile the command was executed on. */ -void CcBuildWagon(Commands cmd, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray, TileIndex tile, EngineID, bool, CargoID, ClientID) +void CcBuildWagon(Commands, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray, TileIndex tile, EngineID, bool, CargoID, ClientID) { if (result.Failed()) return; diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 6d998de96b..e15726e631 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -69,7 +69,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget >= WID_TT_BEGIN && widget < WID_TT_END) { if (_ctrl_pressed) { @@ -104,7 +104,7 @@ public: } } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { Point pt = GetToolbarAlignedWindowPosition(sm_width); pt.y += 2 * (sm_height - this->GetWidget(WID_TT_BUTTONS)->current_y); @@ -116,7 +116,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; for (uint i = WID_TT_BEGIN; i < WID_TT_END; i++) { diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index f5ad488eeb..e0dc5279bc 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -586,7 +586,7 @@ static void DrawTile_Trees(TileInfo *ti) } -static int GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y, bool) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -594,7 +594,7 @@ static int GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y, bool ground_vehi return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } -static Foundation GetFoundation_Trees(TileIndex tile, Slope tileh) +static Foundation GetFoundation_Trees(TileIndex, Slope) { return FOUNDATION_NONE; } @@ -864,12 +864,12 @@ void OnTick_Trees() } } -static TrackStatus GetTileTrackStatus_Trees(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Trees(TileIndex, TransportType, uint, DiagDirection) { return 0; } -static void ChangeTileOwner_Trees(TileIndex tile, Owner old_owner, Owner new_owner) +static void ChangeTileOwner_Trees(TileIndex, Owner, Owner) { /* not used */ } @@ -879,7 +879,7 @@ void InitializeTrees() _trees_tick_ctr = 0; } -static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) +static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int, Slope) { return Command::Do(flags, tile); } diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index fb39ab7fd7..5ffadd5483 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -154,7 +154,7 @@ public: } } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { if (widget >= WID_BT_TYPE_BUTTON_FIRST) { /* Ensure tree type buttons are sized after the largest tree type */ @@ -173,7 +173,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_BT_TYPE_RANDOM: // tree of random type. @@ -214,7 +214,7 @@ public: } } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL) { VpStartPlaceSizing(tile, VPM_X_AND_Y, DDSP_PLANT_TREES); @@ -223,7 +223,7 @@ public: } } - void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) override + void OnPlaceDrag(ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) override { if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL) { VpSelectTilesWithMethod(pt.x, pt.y, select_method); @@ -238,7 +238,7 @@ public: } } - void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) override + void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, TileIndex start_tile, TileIndex end_tile) override { if (_game_mode != GM_EDITOR && this->mode == PM_NORMAL && pt.x != -1 && select_proc == DDSP_PLANT_TREES) { Command::Post(STR_ERROR_CAN_T_PLANT_TREE_HERE, end_tile, start_tile, this->tree_to_plant, _ctrl_pressed); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 901965f379..8a935dfb03 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -262,7 +262,7 @@ bool Vehicle::NeedsAutomaticServicing() const return NeedsServicing(); } -uint Vehicle::Crash(bool flooded) +uint Vehicle::Crash(bool) { assert((this->vehstatus & VS_CRASHED) == 0); assert(this->Previous() == nullptr); // IsPrimaryVehicle fails for free-wagon-chains diff --git a/src/vehicle_base.h b/src/vehicle_base.h index a9a32deb4d..62de9a368a 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -462,13 +462,13 @@ public: * Sets the expense type associated to this vehicle type * @param income whether this is income or (running) expenses of the vehicle */ - virtual ExpensesType GetExpenseType(bool income) const { return EXPENSES_OTHER; } + virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const { return EXPENSES_OTHER; } /** * Play the sound associated with leaving the station * @param force Should we play the sound even if sound effects are muted? (horn hotkey) */ - virtual void PlayLeaveStationSound(bool force = false) const {} + virtual void PlayLeaveStationSound([[maybe_unused]] bool force = false) const {} /** * Whether this is the primary vehicle in the chain. @@ -482,7 +482,7 @@ public: * @param direction the direction the vehicle is facing * @param[out] result Vehicle sprite sequence. */ - virtual void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const { result->Clear(); } + virtual void GetImage([[maybe_unused]] Direction direction, [[maybe_unused]] EngineImageType image_type, [[maybe_unused]] VehicleSpriteSeq *result) const { result->Clear(); } const GRFFile *GetGRF() const; uint32_t GetGRFID() const; @@ -782,7 +782,7 @@ public: * @param station the station to make the next location of the vehicle. * @return the location (tile) to aim for. */ - virtual TileIndex GetOrderStationLocation(StationID station) { return INVALID_TILE; } + virtual TileIndex GetOrderStationLocation([[maybe_unused]] StationID station) { return INVALID_TILE; } /** * Find the closest depot for this vehicle and tell us the location, diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b1832826a8..017dd1b33f 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -884,7 +884,7 @@ struct RefitWindow : public Window { this->DrawWidgets(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_VR_MATRIX: @@ -1040,7 +1040,7 @@ struct RefitWindow : public Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { switch (data) { case VIWD_AUTOREPLACE: // Autoreplace replaced the vehicle; selected_vehicle became invalid. @@ -1148,7 +1148,7 @@ struct RefitWindow : public Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_VR_VEHICLE_PANEL_DISPLAY: { // Vehicle image. @@ -1870,7 +1870,7 @@ public: *this->sorting = this->vehgroups.GetListing(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_VL_LIST: @@ -2019,7 +2019,7 @@ public: this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_VL_ORDER_VIEW: // Open the shared orders window @@ -2163,7 +2163,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope && HasBit(data, 31) && this->vli.type == VL_SHARED_ORDERS) { /* Needs to be done in command-scope, so everything stays valid */ @@ -2349,7 +2349,7 @@ struct VehicleDetailsWindow : Window { * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == VIWD_AUTOREPLACE) { /* Autoreplace replaced the vehicle. @@ -2389,7 +2389,7 @@ struct VehicleDetailsWindow : Window { return desired_height; } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { switch (widget) { case WID_VD_TOP_DETAILS: { @@ -2626,7 +2626,7 @@ struct VehicleDetailsWindow : Window { this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_VD_INCREASE_SERVICING_INTERVAL: // increase int @@ -2808,11 +2808,10 @@ static const StringID _vehicle_msg_translation_table[][4] = { /** * This is the Callback method after attempting to start/stop a vehicle - * @param cmd unused * @param result the result of the start/stop command * @param veh_id Vehicle ID. */ -void CcStartStopVehicle(Commands cmd, const CommandCost &result, VehicleID veh_id, bool) +void CcStartStopVehicle(Commands, const CommandCost &result, VehicleID veh_id, bool) { if (result.Failed()) return; @@ -2950,7 +2949,7 @@ public: this->Window::Close(); } - void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override + void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { const Vehicle *v = Vehicle::Get(this->window_number); switch (widget) { @@ -3111,7 +3110,7 @@ public: DrawString(tr.left, tr.right, CenterBounds(tr.top, tr.bottom, FONT_HEIGHT_NORMAL), str, text_colour, SA_HOR_CENTER); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { const Vehicle *v = Vehicle::Get(this->window_number); @@ -3219,7 +3218,7 @@ public: Command::Post(STR_ERROR_CAN_T_RENAME_TRAIN + Vehicle::Get(this->window_number)->type, this->window_number, str); } - void OnMouseOver(Point pt, int widget) override + void OnMouseOver([[maybe_unused]] Point pt, int widget) override { bool start_stop = widget == WID_VV_START_STOP; if (start_stop != mouse_over_start_stop) { @@ -3266,7 +3265,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (data == VIWD_AUTOREPLACE) { /* Autoreplace replaced the vehicle. @@ -3374,11 +3373,10 @@ void StopGlobalFollowVehicle(const Vehicle *v) /** * This is the Callback method after the construction attempt of a primary vehicle - * @param cmd unused * @param result indicates completion (or not) of the operation * @param new_veh_id ID of the new vehicle. */ -void CcBuildPrimaryVehicle(Commands cmd, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray) +void CcBuildPrimaryVehicle(Commands, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray) { if (result.Failed()) return; diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index f94601813f..7129aae7e8 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -634,7 +634,7 @@ NSView *VideoDriver_CocoaQuartz::AllocateDrawView() } /** Resize the window. */ -void VideoDriver_CocoaQuartz::AllocateBackingStore(bool force) +void VideoDriver_CocoaQuartz::AllocateBackingStore(bool) { if (this->window == nil || this->cocoaview == nil || this->setup) return; diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index 9b17c060bf..f891be2402 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -103,7 +103,7 @@ extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, Detaile static FVideoDriver_Dedicated iFVideoDriver_Dedicated; -const char *VideoDriver_Dedicated::Start(const StringList &parm) +const char *VideoDriver_Dedicated::Start(const StringList &) { this->UpdateAutoResolution(); @@ -140,9 +140,9 @@ void VideoDriver_Dedicated::Stop() free(_dedicated_video_mem); } -void VideoDriver_Dedicated::MakeDirty(int left, int top, int width, int height) {} -bool VideoDriver_Dedicated::ChangeResolution(int w, int h) { return false; } -bool VideoDriver_Dedicated::ToggleFullscreen(bool fs) { return false; } +void VideoDriver_Dedicated::MakeDirty(int, int, int, int) {} +bool VideoDriver_Dedicated::ChangeResolution(int, int) { return false; } +bool VideoDriver_Dedicated::ToggleFullscreen(bool) { return false; } #if defined(UNIX) static bool InputWaiting() diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp index 36947750a5..f0551e8898 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -42,7 +42,7 @@ const char *VideoDriver_Null::Start(const StringList &parm) void VideoDriver_Null::Stop() { } -void VideoDriver_Null::MakeDirty(int left, int top, int width, int height) {} +void VideoDriver_Null::MakeDirty(int, int, int, int) {} void VideoDriver_Null::MainLoop() { @@ -61,6 +61,6 @@ void VideoDriver_Null::MainLoop() } } -bool VideoDriver_Null::ChangeResolution(int w, int h) { return false; } +bool VideoDriver_Null::ChangeResolution(int, int) { return false; } -bool VideoDriver_Null::ToggleFullscreen(bool fs) { return false; } +bool VideoDriver_Null::ToggleFullscreen(bool) { return false; } diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index c9543319ff..1cbcda61af 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -405,7 +405,7 @@ static bool BindPersistentBufferExtensions() } /** Callback to receive OpenGL debug messages. */ -void APIENTRY DebugOutputCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, const void *userParam) +void APIENTRY DebugOutputCallback([[maybe_unused]] GLenum source, GLenum type, [[maybe_unused]] GLuint id, GLenum severity, [[maybe_unused]] GLsizei length, const GLchar *message, [[maybe_unused]] const void *userParam) { /* Make severity human readable. */ const char *severity_str = ""; diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index 25d47a1c72..32f1582e71 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -70,7 +70,7 @@ public: * Change the vsync setting. * @param vsync The new setting. */ - virtual void ToggleVsync(bool vsync) {} + virtual void ToggleVsync([[maybe_unused]] bool vsync) {} /** * Callback invoked after the blitter was changed. diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index cb92196d66..abaf45222e 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -934,7 +934,7 @@ void VideoDriver_Win32Base::EditBoxLostFocus() SetCandidatePos(this->main_wnd); } -static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hDC, LPRECT rc, LPARAM data) +static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC, LPRECT, LPARAM data) { auto &list = *reinterpret_cast*>(data); diff --git a/src/video/win32_v.h b/src/video/win32_v.h index 14f1c6690b..8e9493df8f 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -157,7 +157,7 @@ protected: bool AllocateBackingStore(int w, int h, bool force = false) override; void *GetVideoPointer() override; void ReleaseVideoPointer() override; - void PaletteChanged(HWND hWnd) override {} + void PaletteChanged(HWND) override {} const char *AllocateContext(); void DestroyContext(); diff --git a/src/viewport_gui.cpp b/src/viewport_gui.cpp index c81e4920f6..0c2b136afb 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -88,7 +88,7 @@ public: } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_EV_ZOOM_IN: DoZoomInOutWindow(ZOOM_IN, this); break; @@ -134,7 +134,7 @@ public: this->viewport->dest_scrollpos_y = this->viewport->scrollpos_y; } - bool OnRightClick(Point pt, int widget) override + bool OnRightClick([[maybe_unused]] Point pt, int widget) override { return widget == WID_EV_VIEWPORT; } @@ -151,7 +151,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* Only handle zoom message if intended for us (msg ZOOM_IN/ZOOM_OUT) */ diff --git a/src/void_cmd.cpp b/src/void_cmd.cpp index 031d7a3a80..81dc9ed6c2 100644 --- a/src/void_cmd.cpp +++ b/src/void_cmd.cpp @@ -25,7 +25,7 @@ static void DrawTile_Void(TileInfo *ti) } -static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Void(TileIndex, uint x, uint y, bool) { /* This function may be called on tiles outside the map, don't assume * that 'tile' is a valid tile index. See GetSlopePixelZOutsideMap. */ @@ -35,18 +35,18 @@ static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y, bool ground_vehic return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } -static Foundation GetFoundation_Void(TileIndex tile, Slope tileh) +static Foundation GetFoundation_Void(TileIndex, Slope) { return FOUNDATION_NONE; } -static CommandCost ClearTile_Void(TileIndex tile, DoCommandFlag flags) +static CommandCost ClearTile_Void(TileIndex, DoCommandFlag) { return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP); } -static void GetTileDesc_Void(TileIndex tile, TileDesc *td) +static void GetTileDesc_Void(TileIndex, TileDesc *td) { td->str = STR_EMPTY; td->owner[0] = OWNER_NONE; @@ -58,17 +58,17 @@ static void TileLoop_Void(TileIndex tile) TileLoop_Water(tile); } -static void ChangeTileOwner_Void(TileIndex tile, Owner old_owner, Owner new_owner) +static void ChangeTileOwner_Void(TileIndex, Owner, Owner) { /* not used */ } -static TrackStatus GetTileTrackStatus_Void(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Void(TileIndex, TransportType, uint, DiagDirection) { return 0; } -static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) +static CommandCost TerraformTile_Void(TileIndex, DoCommandFlag, int, Slope) { return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP); } diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 41159d4e36..312f2452d2 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -751,7 +751,7 @@ static void DrawWaterEdges(bool canal, uint offset, TileIndex tile) } /** Draw a plain sea water tile with no edges */ -static void DrawSeaWater(TileIndex tile) +static void DrawSeaWater(TileIndex) { DrawGroundSprite(SPR_FLAT_WATER_TILE, PAL_NONE); } @@ -941,7 +941,7 @@ void DrawShipDepotSprite(int x, int y, Axis axis, DepotPart part) } -static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y, bool ground_vehicle) +static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y, bool) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -949,7 +949,7 @@ static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y, bool ground_vehi return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } -static Foundation GetFoundation_Water(TileIndex tile, Slope tileh) +static Foundation GetFoundation_Water(TileIndex, Slope) { return FOUNDATION_NONE; } @@ -1301,7 +1301,7 @@ void ConvertGroundTilesIntoWaterTiles() } } -static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, uint sub_mode, DiagDirection side) +static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, uint, DiagDirection) { static const TrackBits coast_tracks[] = {TRACK_BIT_NONE, TRACK_BIT_RIGHT, TRACK_BIT_UPPER, TRACK_BIT_NONE, TRACK_BIT_LEFT, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_LOWER, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE, TRACK_BIT_NONE}; @@ -1373,12 +1373,12 @@ static void ChangeTileOwner_Water(TileIndex tile, Owner old_owner, Owner new_own } } -static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int x, int y) +static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *, TileIndex, int, int) { return VETSB_CONTINUE; } -static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) +static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int, Slope) { /* Canals can't be terraformed */ if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST); diff --git a/src/waypoint_base.h b/src/waypoint_base.h index 9abd77ae77..3ddbfc2d99 100644 --- a/src/waypoint_base.h +++ b/src/waypoint_base.h @@ -36,12 +36,12 @@ struct Waypoint FINAL : SpecializedStation { void GetTileArea(TileArea *ta, StationType type) const override; - uint GetPlatformLength(TileIndex tile, DiagDirection dir) const override + uint GetPlatformLength(TileIndex, DiagDirection) const override { return 1; } - uint GetPlatformLength(TileIndex tile) const override + uint GetPlatformLength(TileIndex) const override { return 1; } diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index d2042cf90e..4a296d9087 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -97,7 +97,7 @@ public: this->DrawWidgets(); } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { switch (widget) { case WID_W_CENTER_VIEW: // scroll to location @@ -128,7 +128,7 @@ public: * @param data Information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - void OnInvalidateData(int data = 0, bool gui_scope = true) override + void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override { if (!gui_scope) return; /* You can only change your own waypoints */ diff --git a/src/widget.cpp b/src/widget.cpp index d5990c847b..a6a68ea919 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1151,7 +1151,7 @@ bool NWidgetResizeBase::UpdateVerticalSize(uint min_y) return true; } -void NWidgetResizeBase::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) +void NWidgetResizeBase::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool) { this->StoreSizePosition(sizing, x, y, given_width, given_height); } @@ -1663,7 +1663,7 @@ NWidgetHorizontalLTR::NWidgetHorizontalLTR(NWidContainerFlags flags) : NWidgetHo this->type = NWID_HORIZONTAL_LTR; } -void NWidgetHorizontalLTR::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) +void NWidgetHorizontalLTR::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool) { NWidgetHorizontal::AssignSizePosition(sizing, x, y, given_width, given_height, false); } @@ -1839,27 +1839,27 @@ NWidgetSpacer::NWidgetSpacer(int width, int height) : NWidgetResizeBase(NWID_SPA this->SetResize(0, 0); } -void NWidgetSpacer::SetupSmallestSize(Window *w, bool init_array) +void NWidgetSpacer::SetupSmallestSize(Window *, bool) { this->smallest_x = this->min_x; this->smallest_y = this->min_y; } -void NWidgetSpacer::FillNestedArray(NWidgetBase **array, uint length) +void NWidgetSpacer::FillNestedArray(NWidgetBase **, uint) { } -void NWidgetSpacer::Draw(const Window *w) +void NWidgetSpacer::Draw(const Window *) { /* Spacer widget is never visible. */ } -void NWidgetSpacer::SetDirty(const Window *w) const +void NWidgetSpacer::SetDirty(const Window *) const { /* Spacer widget never need repainting. */ } -NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int x, int y) +NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int, int) { return nullptr; } @@ -1959,7 +1959,7 @@ void NWidgetMatrix::SetupSmallestSize(Window *w, bool init_array) this->resize_y = resize.height; } -void NWidgetMatrix::AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) +void NWidgetMatrix::AssignSizePosition(SizingType, uint x, uint y, uint given_width, uint given_height, bool) { assert(given_width >= this->smallest_x && given_height >= this->smallest_y); diff --git a/src/widget_type.h b/src/widget_type.h index ffa8980111..9191d1cfa6 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -136,7 +136,7 @@ public: virtual bool IsHighlighted() const { return false; } virtual TextColour GetHighlightColour() const { return TC_INVALID; } - virtual void SetHighlighted(TextColour highlight_colour) {} + virtual void SetHighlighted([[maybe_unused]] TextColour highlight_colour) {} /** * Set additional space (padding) around the widget. diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 137c375dcb..af1c4e2f19 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -22,7 +22,7 @@ #include "../safeguards.h" -void DropDownListItem::Draw(const Rect &r, bool sel, Colours bg_colour) const +void DropDownListItem::Draw(const Rect &r, bool, Colours bg_colour) const { int c1 = _colour_gradient[bg_colour][3]; int c2 = _colour_gradient[bg_colour][7]; @@ -41,7 +41,7 @@ uint DropDownListStringItem::Width() const return GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal(); } -void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours bg_colour) const +void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours) const { Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext); DrawString(ir.left, ir.right, r.top, this->String(), sel ? TC_WHITE : TC_BLACK); @@ -67,7 +67,7 @@ DropDownListIconItem::DropDownListIconItem(SpriteID sprite, PaletteID pal, Strin this->sprite_y = dim.height; } -uint DropDownListIconItem::Height(uint width) const +uint DropDownListIconItem::Height(uint) const { return std::max(this->dim.height, (uint)FONT_HEIGHT_NORMAL); } @@ -77,7 +77,7 @@ uint DropDownListIconItem::Width() const return DropDownListStringItem::Width() + this->dim.width + WidgetDimensions::scaled.hsep_wide; } -void DropDownListIconItem::Draw(const Rect &r, bool sel, Colours bg_colour) const +void DropDownListIconItem::Draw(const Rect &r, bool sel, Colours) const { bool rtl = _current_text_dir == TD_RTL; Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext); @@ -197,7 +197,7 @@ struct DropdownWindow : Window { } } - Point OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) override + Point OnInitialPosition([[maybe_unused]] int16_t sm_width, [[maybe_unused]] int16_t sm_height, [[maybe_unused]] int window_number) override { return this->position; } @@ -263,7 +263,7 @@ struct DropdownWindow : Window { } } - void OnClick(Point pt, int widget, int click_count) override + void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { if (widget != WID_DM_ITEMS) return; int item; diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index bfb3f57fec..9f3cc11bb2 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -27,7 +27,7 @@ public: virtual ~DropDownListItem() = default; virtual bool Selectable() const { return false; } - virtual uint Height(uint width) const { return FONT_HEIGHT_NORMAL; } + virtual uint Height([[maybe_unused]] uint) const { return FONT_HEIGHT_NORMAL; } virtual uint Width() const { return 0; } virtual void Draw(const Rect &r, bool sel, Colours bg_colour) const; }; diff --git a/src/window.cpp b/src/window.cpp index 4c6643f92e..bcc86c661e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -518,7 +518,7 @@ void Window::OnFocus() /** * Called when window loses focus */ -void Window::OnFocusLost(bool closing) +void Window::OnFocusLost(bool) { if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxLostFocus(); } @@ -1716,7 +1716,7 @@ static Point LocalGetWindowPlacement(const WindowDesc *desc, int16_t sm_width, i return pt; } -/* virtual */ Point Window::OnInitialPosition(int16_t sm_width, int16_t sm_height, int window_number) +/* virtual */ Point Window::OnInitialPosition([[maybe_unused]]int16_t sm_width, [[maybe_unused]]int16_t sm_height, [[maybe_unused]]int window_number) { return LocalGetWindowPlacement(this->window_desc, sm_width, sm_height, window_number); } diff --git a/src/window_gui.h b/src/window_gui.h index 03f251a52b..26b8dfb2c4 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -540,7 +540,7 @@ public: * @param widget Number of the widget to draw. * @note This method may not change any state, it may only use drawing functions. */ - virtual void DrawWidget(const Rect &r, int widget) const {} + virtual void DrawWidget([[maybe_unused]] const Rect &r, [[maybe_unused]] int widget) const {} /** * Update size and resize step of a widget in the window. @@ -554,7 +554,7 @@ public: * @param fill Fill step of the widget. * @param resize Resize step of the widget. */ - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) {} + virtual void UpdateWidgetSize([[maybe_unused]] int widget, [[maybe_unused]] Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) {} /** * Initialize string parameters for a widget. @@ -562,7 +562,7 @@ public: * and while re-initializing the window. Only for widgets that render text initializing is requested. * @param widget Widget number. */ - virtual void SetStringParameters(int widget) const {} + virtual void SetStringParameters([[maybe_unused]] int widget) const {} /** * The window has gained focus. @@ -582,7 +582,7 @@ public: * @return #ES_HANDLED if the key press has been handled and no other * window should receive the event. */ - virtual EventState OnKeyPress(char32_t key, uint16_t keycode) { return ES_NOT_HANDLED; } + virtual EventState OnKeyPress([[maybe_unused]] char32_t key, [[maybe_unused]] uint16_t keycode) { return ES_NOT_HANDLED; } virtual EventState OnHotkey(int hotkey); @@ -600,7 +600,7 @@ public: * @param widget the clicked widget. * @param click_count Number of fast consecutive clicks at same position */ - virtual void OnClick(Point pt, int widget, int click_count) {} + virtual void OnClick([[maybe_unused]] Point pt, [[maybe_unused]] int widget, [[maybe_unused]] int click_count) {} /** * A click with the right mouse button has been made on the window. @@ -609,14 +609,14 @@ public: * @return true if the click was actually handled, i.e. do not show a * tooltip if tooltip-on-right-click is enabled. */ - virtual bool OnRightClick(Point pt, int widget) { return false; } + virtual bool OnRightClick([[maybe_unused]] Point pt, [[maybe_unused]] int widget) { return false; } /** * The mouse is hovering over a widget in the window, perform an action for it. * @param pt The point where the mouse is hovering. * @param widget The widget where the mouse is hovering. */ - virtual void OnHover(Point pt, int widget) {} + virtual void OnHover([[maybe_unused]] Point pt, [[maybe_unused]] int widget) {} /** * Event to display a custom tooltip. @@ -624,27 +624,27 @@ public: * @param widget The widget where the mouse is located. * @return True if the event is handled, false if it is ignored. */ - virtual bool OnTooltip(Point pt, int widget, TooltipCloseCondition close_cond) { return false; } + virtual bool OnTooltip([[maybe_unused]] Point pt, [[maybe_unused]] int widget, [[maybe_unused]] TooltipCloseCondition close_cond) { return false; } /** * An 'object' is being dragged at the provided position, highlight the target if possible. * @param pt The point inside the window that the mouse hovers over. * @param widget The widget the mouse hovers over. */ - virtual void OnMouseDrag(Point pt, int widget) {} + virtual void OnMouseDrag([[maybe_unused]] Point pt, [[maybe_unused]] int widget) {} /** * A dragged 'object' has been released. * @param pt the point inside the window where the release took place. * @param widget the widget where the release took place. */ - virtual void OnDragDrop(Point pt, int widget) {} + virtual void OnDragDrop([[maybe_unused]] Point pt, [[maybe_unused]] int widget) {} /** * Handle the request for (viewport) scrolling. * @param delta the amount the viewport must be scrolled. */ - virtual void OnScroll(Point delta) {} + virtual void OnScroll([[maybe_unused]] Point delta) {} /** * The mouse is currently moving over the window or has just moved outside @@ -652,13 +652,13 @@ public: * @param pt the point inside the window that the mouse hovers over. * @param widget the widget the mouse hovers over. */ - virtual void OnMouseOver(Point pt, int widget) {} + virtual void OnMouseOver([[maybe_unused]] Point pt, [[maybe_unused]] int widget) {} /** * The mouse wheel has been turned. * @param wheel the amount of movement of the mouse wheel. */ - virtual void OnMouseWheel(int wheel) {} + virtual void OnMouseWheel([[maybe_unused]] int wheel) {} /** @@ -674,7 +674,7 @@ public: /** * Called periodically. */ - virtual void OnRealtimeTick(uint delta_ms) {} + virtual void OnRealtimeTick([[maybe_unused]] uint delta_ms) {} /** * Called when this window's timeout has been reached. @@ -693,7 +693,7 @@ public: * @param widget the widget (button) that the dropdown is associated with. * @param index the element in the dropdown that is selected. */ - virtual void OnDropdownSelect(int widget, int index) {} + virtual void OnDropdownSelect([[maybe_unused]] int widget, [[maybe_unused]] int index) {} virtual void OnDropdownClose(Point pt, int widget, int index, bool instant_close); @@ -701,7 +701,7 @@ public: * The text in an editbox has been edited. * @param widget The widget of the editbox. */ - virtual void OnEditboxChanged(int widget) {} + virtual void OnEditboxChanged([[maybe_unused]] int widget) {} /** * The query window opened from this window has closed. @@ -709,14 +709,14 @@ public: * was cancelled or an empty string when the default * button was pressed, i.e. StrEmpty(str). */ - virtual void OnQueryTextFinished(char *str) {} + virtual void OnQueryTextFinished([[maybe_unused]] char *str) {} /** * Some data on this window has become invalid. * @param data information about the changed data. * @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details. */ - virtual void OnInvalidateData(int data = 0, bool gui_scope = true) {} + virtual void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) {} /** * The user clicked some place on the map when a tile highlight mode @@ -724,7 +724,7 @@ public: * @param pt the exact point on the map that has been clicked. * @param tile the tile on the map that has been clicked. */ - virtual void OnPlaceObject(Point pt, TileIndex tile) {} + virtual void OnPlaceObject([[maybe_unused]] Point pt, [[maybe_unused]] TileIndex tile) {} /** * The user clicked on a vehicle while HT_VEHICLE has been set. @@ -732,7 +732,7 @@ public: * @return true if the click is handled, false if it is ignored * @pre v->IsPrimaryVehicle() == true */ - virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; } + virtual bool OnVehicleSelect([[maybe_unused]] const struct Vehicle *v) { return false; } /** * The user clicked on a vehicle while HT_VEHICLE has been set. @@ -740,7 +740,7 @@ public: * @return True if the click is handled, false if it is ignored * @pre v->IsPrimaryVehicle() == true */ - virtual bool OnVehicleSelect(VehicleList::const_iterator begin, VehicleList::const_iterator end) { return false; } + virtual bool OnVehicleSelect([[maybe_unused]] VehicleList::const_iterator begin, [[maybe_unused]] VehicleList::const_iterator end) { return false; } /** * The user cancelled a tile highlight mode that has been set. @@ -755,7 +755,7 @@ public: * @param select_proc what will be created when the drag is over. * @param pt the exact point on the map where the mouse is. */ - virtual void OnPlaceDrag(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt) {} + virtual void OnPlaceDrag([[maybe_unused]] ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt) {} /** * The user has dragged over the map when the tile highlight mode @@ -766,7 +766,7 @@ public: * @param start_tile the begin tile of the drag. * @param end_tile the end tile of the drag. */ - virtual void OnPlaceMouseUp(ViewportPlaceMethod select_method, ViewportDragDropSelectionProcess select_proc, Point pt, TileIndex start_tile, TileIndex end_tile) {} + virtual void OnPlaceMouseUp([[maybe_unused]] ViewportPlaceMethod select_method, [[maybe_unused]] ViewportDragDropSelectionProcess select_proc, [[maybe_unused]] Point pt, [[maybe_unused]] TileIndex start_tile, [[maybe_unused]] TileIndex end_tile) {} /** * The user moves over the map when a tile highlight mode has been set @@ -775,7 +775,7 @@ public: * @param pt the exact point on the map where the mouse is. * @param tile the tile on the map where the mouse is. */ - virtual void OnPlacePresize(Point pt, TileIndex tile) {} + virtual void OnPlacePresize([[maybe_unused]] Point pt, [[maybe_unused]] TileIndex tile) {} /*** End of the event handling ***/ From b5885295f0e29086f4c6aaac7ecee82720537fdd Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 16 Sep 2023 23:25:17 +0200 Subject: [PATCH 22/59] Codechange: Use parameters, which should be used. --- src/airport_gui.cpp | 9 +++++---- src/cheat_gui.cpp | 2 ++ src/game/game_gui.cpp | 2 ++ src/misc_gui.cpp | 4 ++-- src/network/network_chat_gui.cpp | 6 ++++-- src/newgrf_gui.cpp | 15 ++++++++++----- src/object_gui.cpp | 14 ++++++++------ src/osk_gui.cpp | 8 +++++--- src/rail_gui.cpp | 12 +++++++----- src/road_gui.cpp | 12 +++++++----- src/script/script_gui.cpp | 2 ++ src/station_gui.cpp | 20 ++++++++++++-------- src/video/sdl2_opengl_v.cpp | 2 +- 13 files changed, 67 insertions(+), 41 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 5fe50793ec..9218c9446a 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -563,10 +563,11 @@ public: void OnDropdownSelect(int widget, int index) override { - assert(widget == WID_AP_CLASS_DROPDOWN); - _selected_airport_class = (AirportClassID)index; - this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount()); - this->SelectFirstAvailableAirport(false); + if (widget == WID_AP_CLASS_DROPDOWN) { + _selected_airport_class = (AirportClassID)index; + this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount()); + this->SelectFirstAvailableAirport(false); + } } void OnRealtimeTick([[maybe_unused]] uint delta_ms) override diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index 7fa5b42fa0..8ac25550a4 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -345,6 +345,8 @@ struct CheatWindow : Window { void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { + if (widget != WID_C_PANEL) return; + Rect r = this->GetWidget(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect); uint btn = (pt.y - r.top) / this->line_height; uint x = pt.x - r.left; diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index e2142da061..fd9e2c9957 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -367,12 +367,14 @@ struct GSConfigWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget >= 0) return; assert(this->clicked_dropdown); SetValue(index); } void OnDropdownClose(Point, int widget, int, bool) override { + if (widget >= 0) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 13f97e1b44..1e2474782f 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -698,7 +698,7 @@ struct TooltipsWindow : public Window void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override { - /* There is only one widget. */ + if (widget != WID_TT_BACKGROUND) return; CopyInDParam(this->params); size->width = std::min(GetStringBoundingBox(this->string_id).width, ScaleGUITrad(194)); @@ -711,7 +711,7 @@ struct TooltipsWindow : public Window void DrawWidget(const Rect &r, int widget) const override { - /* There is only one widget. */ + if (widget != WID_TT_BACKGROUND) return; GfxFillRect(r, PC_BLACK); GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_LIGHT_YELLOW); diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 1ce4f58ba4..3ccfb42f38 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -474,9 +474,11 @@ struct NetworkChatWindow : public Window { return state; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - _chat_tab_completion_active = false; + if (widget == WID_NC_TEXTBOX) { + _chat_tab_completion_active = false; + } } /** diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index acfe87ed58..81fb85560b 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -453,6 +453,7 @@ struct NewGRFParametersWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget >= 0) return; assert(this->clicked_dropdown); GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row); par_info.SetValue(this->grf_config, index); @@ -461,6 +462,7 @@ struct NewGRFParametersWindow : public Window { void OnDropdownClose(Point, int widget, int, bool) override { + if (widget >= 0) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is @@ -1169,6 +1171,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { void OnDropdownSelect(int widget, int index) override { + if (widget >= 0) return; if (!this->editable) return; ClearGRFConfigList(&this->actives); @@ -1352,14 +1355,16 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { if (!this->editable) return; - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->avails.SetFilterState(!string_filter.IsEmpty()); - this->avails.ForceRebuild(); - this->InvalidateData(0); + if (widget == WID_NS_FILTER) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->avails.SetFilterState(!string_filter.IsEmpty()); + this->avails.ForceRebuild(); + this->InvalidateData(0); + } } void OnDragDrop(Point pt, int widget) override diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 8e43bdf554..0a35a77a15 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -480,7 +480,7 @@ public: object_number = -1; } else { view_number = sel_view; - ObjectClass *objclass = ObjectClass::Get(_selected_object_class); + ObjectClass *objclass = ObjectClass::Get(object_class); object_number = objclass->GetUIFromIndex(sel_index); } @@ -583,12 +583,14 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->object_classes.SetFilterState(!string_filter.IsEmpty()); - this->object_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BO_FILTER) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->object_classes.SetFilterState(!string_filter.IsEmpty()); + this->object_classes.ForceRebuild(); + this->InvalidateData(); + } } /** diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 4f4e56737b..dfb59c1474 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -185,9 +185,11 @@ struct OskWindow : public Window { void OnEditboxChanged(int widget) override { - this->SetWidgetDirty(WID_OSK_TEXT); - this->parent->OnEditboxChanged(this->text_btn); - this->parent->SetWidgetDirty(this->text_btn); + if (widget == WID_OSK_TEXT) { + this->SetWidgetDirty(WID_OSK_TEXT); + this->parent->OnEditboxChanged(this->text_btn); + this->parent->SetWidgetDirty(this->text_btn); + } } void OnInvalidateData([[maybe_unused]] int data = 0, [[maybe_unused]] bool gui_scope = true) override diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 2bf47f86a9..4125156878 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1127,12 +1127,14 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->station_classes.SetFilterState(!string_filter.IsEmpty()); - this->station_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BRAS_FILTER_EDITBOX) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->station_classes.SetFilterState(!string_filter.IsEmpty()); + this->station_classes.ForceRebuild(); + this->InvalidateData(); + } } void OnPaint() override diff --git a/src/road_gui.cpp b/src/road_gui.cpp index b67f5750af..333730c4c0 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -1306,12 +1306,14 @@ public: return ES_NOT_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->roadstop_classes.SetFilterState(!string_filter.IsEmpty()); - this->roadstop_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BROS_FILTER_EDITBOX) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->roadstop_classes.SetFilterState(!string_filter.IsEmpty()); + this->roadstop_classes.ForceRebuild(); + this->InvalidateData(); + } } void OnPaint() override diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 5ffcdf699c..91e2f47e04 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -526,12 +526,14 @@ struct ScriptSettingsWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget >= 0) return; assert(this->clicked_dropdown); SetValue(index); } void OnDropdownClose(Point, int widget, int, bool) override { + if (widget >= 0) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is diff --git a/src/station_gui.cpp b/src/station_gui.cpp index d05a3aeeb6..593acb4ef7 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -638,13 +638,15 @@ public: void OnDropdownSelect(int widget, int index) override { - if (this->stations.SortType() != index) { - this->stations.SetSortType(index); + if (widget == WID_STL_SORTDROPBTN) { + if (this->stations.SortType() != index) { + this->stations.SetSortType(index); - /* Display the current sort variant */ - this->GetWidget(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()]; + /* Display the current sort variant */ + this->GetWidget(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()]; - this->SetDirty(); + this->SetDirty(); + } } } @@ -1466,9 +1468,11 @@ struct StationViewWindow : public Window { void SetStringParameters(int widget) const override { - const Station *st = Station::Get(this->window_number); - SetDParam(0, st->index); - SetDParam(1, st->facilities); + if (widget == WID_SV_CAPTION) { + const Station *st = Station::Get(this->window_number); + SetDParam(0, st->index); + SetDParam(1, st->facilities); + } } /** diff --git a/src/video/sdl2_opengl_v.cpp b/src/video/sdl2_opengl_v.cpp index 7460f34bb5..ac5ceb0361 100644 --- a/src/video/sdl2_opengl_v.cpp +++ b/src/video/sdl2_opengl_v.cpp @@ -50,7 +50,7 @@ static OGLProc GetOGLProcAddressCallback(const char *proc) bool VideoDriver_SDL_OpenGL::CreateMainWindow(uint w, uint h, uint flags) { - return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, SDL_WINDOW_OPENGL); + return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, flags | SDL_WINDOW_OPENGL); } const char *VideoDriver_SDL_OpenGL::Start(const StringList ¶m) From 5733145c592506091f236a2600aa5147dc13647a Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 16 Sep 2023 23:27:16 +0200 Subject: [PATCH 23/59] Cleanup: Remove unneeded parameters. --- src/gfx_layout_icu.cpp | 6 ++---- src/industry_cmd.cpp | 6 +++--- src/network/network.cpp | 7 +++---- src/network/network_func.h | 2 +- src/newgrf_airporttiles.cpp | 6 +++--- src/newgrf_airporttiles.h | 2 +- src/newgrf_industrytiles.cpp | 4 ++-- src/os/windows/font_win32.cpp | 6 +++--- src/os/windows/font_win32.h | 2 +- src/rail_cmd.cpp | 5 ++--- src/road_cmd.cpp | 9 ++++----- src/station_cmd.cpp | 7 +++---- src/town.h | 2 +- src/town_cmd.cpp | 23 +++++++++++------------ src/video/win32_v.cpp | 7 +++---- src/waypoint_cmd.cpp | 4 ++-- 16 files changed, 45 insertions(+), 53 deletions(-) diff --git a/src/gfx_layout_icu.cpp b/src/gfx_layout_icu.cpp index 35d9eaf7f2..a635c0c80c 100644 --- a/src/gfx_layout_icu.cpp +++ b/src/gfx_layout_icu.cpp @@ -340,13 +340,11 @@ std::vector ItemizeScript(UChar *buff, size_t length, std::vector ItemizeStyle(UChar *buff, size_t length, std::vector &runs_current, FontMap &font_mapping) +std::vector ItemizeStyle(std::vector &runs_current, FontMap &font_mapping) { std::vector runs; @@ -380,7 +378,7 @@ std::vector ItemizeStyle(UChar *buff, size_t length, std::vector auto runs = ItemizeBidi(buff, length); runs = ItemizeScript(buff, length, runs); - runs = ItemizeStyle(buff, length, runs, font_mapping); + runs = ItemizeStyle(runs, font_mapping); if (runs.size() == 0) return nullptr; diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 64d69988db..6c74ac1513 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -1585,7 +1585,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i * This function tries to flatten out the land below an industry, without * damaging the surroundings too much. */ -static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout, int type) +static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout) { int max_x = 0; int max_y = 0; @@ -1990,7 +1990,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do if (ret.Failed()) return ret; if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && - !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout, type)) { + !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -1998,7 +1998,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do if (flags & DC_EXEC) { *ip = new Industry(tile); - if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout, type); + if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout); DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits); } diff --git a/src/network/network.cpp b/src/network/network.cpp index 12db048c18..af65a53542 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -870,7 +870,7 @@ bool NetworkServerStart() /* Check for the client and server names to be set, but only after the scripts had a chance to set them.*/ if (_network_dedicated) CheckClientAndServerName(); - NetworkDisconnect(false, false); + NetworkDisconnect(false); NetworkInitialize(false); NetworkUDPInitialize(); Debug(net, 5, "Starting listeners for clients"); @@ -938,10 +938,9 @@ void NetworkReboot() /** * We want to disconnect from the host/clients. - * @param blocking whether to wait till everything has been closed. * @param close_admins Whether the admin sockets need to be closed as well. */ -void NetworkDisconnect(bool blocking, bool close_admins) +void NetworkDisconnect(bool close_admins) { if (_network_server) { for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) { @@ -1263,7 +1262,7 @@ void NetworkStartUp() /** This shuts the network down */ void NetworkShutDown() { - NetworkDisconnect(true); + NetworkDisconnect(); NetworkHTTPUninitialize(); NetworkUDPClose(); diff --git a/src/network/network_func.h b/src/network/network_func.h index 9531e6d0fb..0c0e6d2201 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -43,7 +43,7 @@ void NetworkUpdateServerGameType(); bool NetworkCompanyHasClients(CompanyID company); std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password); void NetworkReboot(); -void NetworkDisconnect(bool blocking = false, bool close_admins = true); +void NetworkDisconnect(bool close_admins = true); void NetworkGameLoop(); void NetworkBackgroundLoop(); std::string_view ParseFullConnectionString(const std::string &connection_string, uint16_t &port, CompanyID *company_id = nullptr); diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index f9fa2f86d4..5204d7b55b 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -237,7 +237,7 @@ uint16_t GetAirportTileCallback(CallbackID callback, uint32_t param1, uint32_t p return object.ResolveCallback(); } -static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour, StationGfx gfx) +static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour) { const DrawTileSprites *dts = group->ProcessRegisters(nullptr); @@ -255,7 +255,7 @@ static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGrou DrawNewGRFTileSeq(ti, dts, TO_BUILDINGS, 0, GENERAL_SPRITE_COLOUR(colour)); } -bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts) +bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts) { if (ti->tileh != SLOPE_FLAT) { bool draw_old_one = true; @@ -275,7 +275,7 @@ bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const Airport } const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; - AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour, gfx); + AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour); return true; } diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h index de1a984e2a..9a46030a33 100644 --- a/src/newgrf_airporttiles.h +++ b/src/newgrf_airporttiles.h @@ -87,6 +87,6 @@ private: void AnimateAirportTile(TileIndex tile); void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); -bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts); +bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts); #endif /* NEWGRF_AIRPORTTILES_H */ diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 62a4cd0c52..0cb0952a0b 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -155,7 +155,7 @@ uint32_t IndustryTileResolverObject::GetDebugID() const return GetIndustryTileSpec(gfx)->grf_prop.local_id; } -static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx) +static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage) { const DrawTileSprites *dts = group->ProcessRegisters(&stage); @@ -208,7 +208,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus /* Limit the building stage to the number of stages supplied. */ const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; byte stage = GetIndustryConstructionStage(ti->tile); - IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage, gfx); + IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage); return true; } diff --git a/src/os/windows/font_win32.cpp b/src/os/windows/font_win32.cpp index 4d92ee0217..466ef1c01d 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -126,7 +126,7 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &, int winla Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) : TrueTypeFontCache(fs, pixels), logfont(logfont) { this->dc = CreateCompatibleDC(nullptr); - this->SetFontSize(fs, pixels); + this->SetFontSize(pixels); } Win32FontCache::~Win32FontCache() @@ -136,7 +136,7 @@ Win32FontCache::~Win32FontCache() DeleteObject(this->font); } -void Win32FontCache::SetFontSize(FontSize fs, int pixels) +void Win32FontCache::SetFontSize(int pixels) { if (pixels == 0) { /* Try to determine a good height based on the minimal height recommended by the font. */ @@ -202,7 +202,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) void Win32FontCache::ClearFontCache() { /* GUI scaling might have changed, determine font size anew if it was automatically selected. */ - if (this->font != nullptr) this->SetFontSize(this->fs, this->req_size); + if (this->font != nullptr) this->SetFontSize(this->req_size); this->TrueTypeFontCache::ClearFontCache(); } diff --git a/src/os/windows/font_win32.h b/src/os/windows/font_win32.h index 527caffd46..7ef5568601 100644 --- a/src/os/windows/font_win32.h +++ b/src/os/windows/font_win32.h @@ -23,7 +23,7 @@ private: SIZE glyph_size; ///< Maximum size of regular glyphs. std::string fontname; ///< Cached copy of loaded font facename - void SetFontSize(FontSize fs, int pixels); + void SetFontSize(int pixels); protected: const void *InternalGetFontTable(uint32_t tag, size_t &length) override; diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 46d6f9a030..1d312ffd49 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -236,10 +236,9 @@ static CommandCost EnsureNoTrainOnTrack(TileIndex tile, Track track) * Check that the new track bits may be built. * @param tile %Tile to build on. * @param to_build New track bits. - * @param flags Flags of the operation. * @return Succeeded or failed command. */ -static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build, uint flags) +static CommandCost CheckTrackCombination(TileIndex tile, TrackBits to_build) { if (!IsPlainRail(tile)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION); @@ -442,7 +441,7 @@ CommandCost CmdBuildSingleRail(DoCommandFlag flags, TileIndex tile, RailType rai if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_ERROR_IMPOSSIBLE_TRACK_COMBINATION); - ret = CheckTrackCombination(tile, trackbit, flags); + ret = CheckTrackCombination(tile, trackbit); if (ret.Succeeded()) ret = EnsureNoTrainOnTrack(tile, track); if (ret.Failed()) return ret; diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 29791c6c24..102efa3a83 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -319,10 +319,9 @@ CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, R * @param flags operation to perform * @param pieces roadbits to remove * @param rt roadtype to remove - * @param crossing_check should we check if there is a tram track when we are removing road from crossing? * @param town_check should we check if the town allows removal? */ -static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool crossing_check, bool town_check = true) +static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool town_check) { assert(pieces != ROAD_NONE); @@ -1110,7 +1109,7 @@ std::tuple CmdRemoveLongRoad(DoCommandFlag flags, TileIndex if (money_spent > 0 && money_spent > money_available) { return { cost, std::get<0>(Command::Do(flags & ~DC_EXEC, end_tile, start_tile, rt, axis, start_half, end_half)).GetCost() }; } - RemoveRoad(tile, flags, bits, rtt, true, false); + RemoveRoad(tile, flags, bits, rtt, false); } cost.AddCost(ret); had_success = true; @@ -1261,7 +1260,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags) for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) { if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue; - CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, false); + CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, true); if (tmp_ret.Failed()) return tmp_ret; ret.AddCost(tmp_ret); } @@ -2035,7 +2034,7 @@ static void TileLoop_Road(TileIndex tile) /* Possibly change road type */ if (GetRoadOwner(tile, RTT_ROAD) == OWNER_TOWN) { - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); if (rt != GetRoadTypeRoad(tile)) { SetRoadType(tile, RTT_ROAD, rt); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 33aa52f5da..cb0afc4b54 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1072,10 +1072,9 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags * Check whether we can expand the rail part of the given station. * @param st the station to expand * @param new_ta the current (and if all is fine new) tile area of the rail part of the station - * @param axis the axis of the newly build rail * @return Succeeded or failed command. */ -CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis) +CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta) { TileArea cur_ta = st->train_station; @@ -1355,7 +1354,7 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp if (ret.Failed()) return ret; if (st != nullptr && st->train_station.tile != INVALID_TILE) { - ret = CanExpandRailStation(st, new_location, axis); + ret = CanExpandRailStation(st, new_location); if (ret.Failed()) return ret; } @@ -2967,7 +2966,7 @@ static void DrawTile_Station(TileInfo *ti) gfx = GetAirportGfx(ti->tile); if (gfx >= NEW_AIRPORTTILE_OFFSET) { const AirportTileSpec *ats = AirportTileSpec::Get(gfx); - if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), gfx, ats)) { + if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), ats)) { return; } /* No sprite group (or no valid one) found, meaning no graphics associated. diff --git a/src/town.h b/src/town.h index 60ec9deae5..5b400217b6 100644 --- a/src/town.h +++ b/src/town.h @@ -309,6 +309,6 @@ static inline uint16_t TownTicksToGameTicks(uint16_t ticks) { } -RoadType GetTownRoadType(const Town *t); +RoadType GetTownRoadType(); #endif /* TOWN_H */ diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index cd912f28c7..528a8ce49a 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -852,7 +852,7 @@ static RoadBits GetTownRoadBits(TileIndex tile) return GetAnyRoadBits(tile, RTT_ROAD, true); } -RoadType GetTownRoadType(const Town *t) +RoadType GetTownRoadType() { RoadType best_rt = ROADTYPE_ROAD; const RoadTypeInfo *best = nullptr; @@ -939,7 +939,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir) /* No, try if we are able to build a road piece there. * If that fails clear the land, and if that fails exit. * This is to make sure that we can build a road here later. */ - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); if (Command::Do(DC_AUTO | DC_NO_WATER, tile, (dir == DIAGDIR_NW || dir == DIAGDIR_SE) ? ROAD_Y : ROAD_X, rt, DRD_NONE, 0).Failed() && Command::Do(DC_AUTO | DC_NO_WATER, tile).Failed()) { return false; @@ -1108,7 +1108,7 @@ static bool GrowTownWithExtraHouse(Town *t, TileIndex tile) */ static bool GrowTownWithRoad(const Town *t, TileIndex tile, RoadBits rcmd) { - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); if (Command::Do(DC_EXEC | DC_AUTO | DC_NO_WATER, tile, rcmd, rt, DRD_NONE, t->index).Succeeded()) { _grow_town_result = GROWTH_SUCCEED; return true; @@ -1130,7 +1130,7 @@ static bool CanRoadContinueIntoNextTile(const Town *t, const TileIndex tile, con const int delta = TileOffsByDiagDir(road_dir); // +1 tile in the direction of the road TileIndex next_tile = tile + delta; // The tile beyond which must be connectable to the target tile RoadBits rcmd = DiagDirToRoadBits(ReverseDiagDir(road_dir)); - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); /* Before we try anything, make sure the tile is on the map and not the void. */ if (!IsValidTile(next_tile)) return false; @@ -1250,7 +1250,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi byte bridge_type = RandomRange(MAX_BRIDGES - 1); /* Can we actually build the bridge? */ - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); if (Command::Do(CommandFlagsToDCFlags(GetCommandFlags()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt).Succeeded()) { Command::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags()), tile, bridge_tile, TRANSPORT_ROAD, bridge_type, rt); _grow_town_result = GROWTH_SUCCEED; @@ -1321,7 +1321,7 @@ static bool GrowTownWithTunnel(const Town *t, const TileIndex tile, const DiagDi if (!CanRoadContinueIntoNextTile(t, tunnel_tile, tunnel_dir)) return false; /* Attempt to build the tunnel. Return false if it fails to let the town build a road instead. */ - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); if (Command::Do(CommandFlagsToDCFlags(GetCommandFlags()), tile, TRANSPORT_ROAD, rt).Succeeded()) { Command::Do(DC_EXEC | CommandFlagsToDCFlags(GetCommandFlags()), tile, TRANSPORT_ROAD, rt); _grow_town_result = GROWTH_SUCCEED; @@ -1362,17 +1362,16 @@ static inline bool RoadTypesAllowHouseHere(TileIndex t) } /** Test if town can grow road onto a specific tile. - * @param town Town that is building. * @param tile Tile to build upon. * @return true iff the tile's road type don't prevent extending the road. */ -static bool TownCanGrowRoad(const Town *town, TileIndex tile) +static bool TownCanGrowRoad(TileIndex tile) { if (!IsTileType(tile, MP_ROAD)) return true; /* Allow extending on roadtypes which can be built by town, or if the road type matches the type the town will build. */ RoadType rt = GetRoadTypeRoad(tile); - return HasBit(GetRoadTypeInfo(rt)->flags, ROTF_TOWN_BUILD) || GetTownRoadType(town) == rt; + return HasBit(GetRoadTypeInfo(rt)->flags, ROTF_TOWN_BUILD) || GetTownRoadType() == rt; } /** @@ -1451,7 +1450,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t } } else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) { - if (!TownCanGrowRoad(t1, tile)) return; + if (!TownCanGrowRoad(tile)) return; /* Continue building on a partial road. * Should be always OK, so we only generate @@ -1572,7 +1571,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t return; } - if (!TownCanGrowRoad(t1, tile)) return; + if (!TownCanGrowRoad(tile)) return; _grow_town_result = GROWTH_SEARCH_STOPPED; } @@ -1780,7 +1779,7 @@ static bool GrowTown(Town *t) /* Only work with plain land that not already has a house */ if (!IsTileType(tile, MP_HOUSE) && IsTileFlat(tile)) { if (Command::Do(DC_AUTO | DC_NO_WATER, tile).Succeeded()) { - RoadType rt = GetTownRoadType(t); + RoadType rt = GetTownRoadType(); Command::Do(DC_EXEC | DC_AUTO, tile, GenRandomRoadBits(), rt, DRD_NONE, t->index); cur_company.Restore(); return true; diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp index abaf45222e..0293cd9b64 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -1237,10 +1237,9 @@ static OGLProc GetOGLProcAddressCallback(const char *proc) /** * Set the pixel format of a window- * @param dc Device context to set the pixel format of. - * @param fullscreen Should the pixel format be used for fullscreen drawing? * @return nullptr on success, error message otherwise. */ -static const char *SelectPixelFormat(HDC dc, bool fullscreen) +static const char *SelectPixelFormat(HDC dc) { PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // Size of this struct. @@ -1281,7 +1280,7 @@ static void LoadWGLExtensions() HDC dc = GetDC(wnd); /* Set pixel format of the window. */ - if (SelectPixelFormat(dc, false) == nullptr) { + if (SelectPixelFormat(dc) == nullptr) { /* Create rendering context. */ HGLRC rc = wglCreateContext(dc); if (rc != nullptr) { @@ -1396,7 +1395,7 @@ const char *VideoDriver_Win32OpenGL::AllocateContext() { this->dc = GetDC(this->main_wnd); - const char *err = SelectPixelFormat(this->dc, this->fullscreen); + const char *err = SelectPixelFormat(this->dc); if (err != nullptr) return err; HGLRC rc = nullptr; diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index e6e7291cb7..11da28b6dd 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -156,7 +156,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID * extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec); extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp); -extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis); +extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta); /** * Convert existing rail to waypoint. Eg build a waypoint station over @@ -224,7 +224,7 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis /* check if we want to expand an already existing waypoint? */ if (wp->train_station.tile != INVALID_TILE) { - ret = CanExpandRailStation(wp, new_location, axis); + ret = CanExpandRailStation(wp, new_location); if (ret.Failed()) return ret; } From baf7cc858ba1f21d5698275a693ce55f681e32bd Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 16 Sep 2023 23:51:49 +0200 Subject: [PATCH 24/59] Codechange: Rename ship docking tile related functions. --- src/ship_cmd.cpp | 2 +- src/station_cmd.cpp | 14 -------------- src/station_func.h | 1 - src/station_map.h | 31 +++++++------------------------ src/water_cmd.cpp | 2 +- 5 files changed, 9 insertions(+), 41 deletions(-) diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index cab94cf334..2e0186d714 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -624,7 +624,7 @@ bool IsShipDestinationTile(TileIndex tile, StationID station) for (DiagDirection d = DIAGDIR_BEGIN; d != DIAGDIR_END; d++) { TileIndex t = tile + TileOffsByDiagDir(d); if (!IsValidTile(t)) continue; - if (IsDockTile(t) && GetStationIndex(t) == station && IsValidDockingDirectionForDock(t, d)) return true; + if (IsDockTile(t) && GetStationIndex(t) == station && IsDockWaterPart(t)) return true; if (IsTileType(t, MP_INDUSTRY)) { const Industry *i = Industry::GetByTile(t); if (i->neutral_station != nullptr && i->neutral_station->index == station) return true; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index cb0afc4b54..2ab50585e9 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2740,20 +2740,6 @@ void ClearDockingTilesCheckingNeighbours(TileIndex tile) } } -/** - * Check if a dock tile can be docked from the given direction. - * @param t Tile index of dock. - * @param d DiagDirection adjacent to dock being tested. (unused) - * @return True iff the dock can be docked from the given direction. - */ -bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d) -{ - assert(IsDockTile(t)); - - StationGfx gfx = GetStationGfx(t); - return gfx >= GFX_DOCK_BASE_WATER_PART; -} - /** * Find the part of a dock that is land-based * @param t Dock tile to find land part of diff --git a/src/station_func.h b/src/station_func.h index 8d96c473ab..6b1fbd0413 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -40,7 +40,6 @@ void DeleteOilRig(TileIndex t); void UpdateStationDockingTiles(Station *st); void RemoveDockingTile(TileIndex t); void ClearDockingTilesCheckingNeighbours(TileIndex tile); -bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d); /* Check if a rail station tile is traversable. */ bool IsStationTileBlocked(TileIndex tile); diff --git a/src/station_map.h b/src/station_map.h index f525cb48ba..7eee619e02 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -435,30 +435,13 @@ static inline DiagDirection GetDockDirection(Tile t) } /** - * Get the tileoffset from this tile a ship should target to get to this dock. - * @param t Tile to query - * @pre IsTileType(t, MP_STATION) - * @pre IsBuoy(t) || IsOilRig(t) || IsDock(t) - * @return The offset from this tile that should be used as destination for ships. - */ -static inline TileIndexDiffC GetDockOffset(Tile t) -{ - static const TileIndexDiffC buoy_offset = {0, 0}; - static const TileIndexDiffC oilrig_offset = {2, 0}; - static const TileIndexDiffC dock_offset[DIAGDIR_END] = { - {-2, 0}, - { 0, 2}, - { 2, 0}, - { 0, -2}, - }; - assert(IsTileType(t, MP_STATION)); - - if (IsBuoy(t)) return buoy_offset; - if (IsOilRig(t)) return oilrig_offset; - - assert(IsDock(t)); - - return dock_offset[GetDockDirection(t)]; + * Check whether a dock tile is the tile on water. + */ +static inline bool IsDockWaterPart(Tile t) +{ + assert(IsDockTile(t)); + StationGfx gfx = GetStationGfx(t); + return gfx >= GFX_DOCK_BASE_WATER_PART; } /** diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 312f2452d2..15e24734ba 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -186,7 +186,7 @@ void CheckForDockingTile(TileIndex t) TileIndex tile = t + TileOffsByDiagDir(d); if (!IsValidTile(tile)) continue; - if (IsDockTile(tile) && IsValidDockingDirectionForDock(tile, d)) { + if (IsDockTile(tile) && IsDockWaterPart(tile)) { Station::GetByTile(tile)->docking_station.Add(t); SetDockingTile(t, true); } From 55da426d44a14271457ae14c61e673b2c9ddc6fa Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 17 Sep 2023 00:33:35 +0200 Subject: [PATCH 25/59] Codechange: All ParagraphLayoutFactory::AppendToBuffer assume that the buffer has at least some space. Assert on that. --- src/gfx_layout_fallback.cpp | 3 ++- src/gfx_layout_icu.cpp | 1 + src/os/macosx/string_osx.h | 1 + src/os/windows/string_uniscribe.h | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gfx_layout_fallback.cpp b/src/gfx_layout_fallback.cpp index 1b3d020ac4..b44e874935 100644 --- a/src/gfx_layout_fallback.cpp +++ b/src/gfx_layout_fallback.cpp @@ -96,8 +96,9 @@ public: * @param c The character to add. * @return The number of buffer spaces that were used. */ -/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(char32_t *buff, const char32_t *buffer_last, char32_t c) +/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(char32_t *buff, [[maybe_unused]] const char32_t *buffer_last, char32_t c) { + assert(buff < buffer_last); *buff = c; return 1; } diff --git a/src/gfx_layout_icu.cpp b/src/gfx_layout_icu.cpp index a635c0c80c..981563c4d8 100644 --- a/src/gfx_layout_icu.cpp +++ b/src/gfx_layout_icu.cpp @@ -522,6 +522,7 @@ std::unique_ptr ICUParagraphLayout::NextLine(int /* static */ size_t ICUParagraphLayoutFactory::AppendToBuffer(UChar *buff, const UChar *buffer_last, char32_t c) { + assert(buff < buffer_last); /* Transform from UTF-32 to internal ICU format of UTF-16. */ int32_t length = 0; UErrorCode err = U_ZERO_ERROR; diff --git a/src/os/macosx/string_osx.h b/src/os/macosx/string_osx.h index 19c8ba5040..8fd9d988dc 100644 --- a/src/os/macosx/string_osx.h +++ b/src/os/macosx/string_osx.h @@ -63,6 +63,7 @@ public: */ static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, char32_t c) { + assert(buff < buffer_last); if (c >= 0x010000U) { /* Character is encoded using surrogates in UTF-16. */ if (buff + 1 <= buffer_last) { diff --git a/src/os/windows/string_uniscribe.h b/src/os/windows/string_uniscribe.h index 56537be264..0c63d468c3 100644 --- a/src/os/windows/string_uniscribe.h +++ b/src/os/windows/string_uniscribe.h @@ -45,6 +45,7 @@ public: */ static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, char32_t c) { + assert(buff < buffer_last); if (c >= 0x010000U) { /* Character is encoded using surrogates in UTF-16. */ if (buff + 1 <= buffer_last) { From a7707302e652d2aab2e65d2a20f79632137d29d8 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 17 Sep 2023 01:35:33 +0200 Subject: [PATCH 26/59] Codechange: silence false warning. --- src/saveload/saveload.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 124ae8239a..2e1131a778 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1767,7 +1767,7 @@ std::vector SlTableHeader(const SaveLoadTable &slt) } while (true) { - uint8_t type; + uint8_t type = 0; SlSaveLoadConv(&type, SLE_UINT8); if (type == SLE_FILE_END) break; From 2ff4248032d25a9bad2996f8e35ad11a6212761d Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 17 Sep 2023 01:08:15 +0200 Subject: [PATCH 27/59] Codechange: Enable more warnings. --- cmake/CompileFlags.cmake | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index ef2ea2dd49..acf2c2180e 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -38,7 +38,11 @@ macro(compile_flags) set(IS_STABLE_RELEASE "$>,$>>") if(MSVC) - add_compile_options(/W3) + add_compile_options( + /W3 + /w34100 # 'identifier' : unreferenced formal parameter + /w34189 # 'identifier' : local variable is initialized but not referenced + ) if(MSVC_VERSION GREATER 1929 AND MSVC_VERSION LESS 1937 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Starting with version 19.30 (fixed in version 19.37), there is an optimisation bug, see #9966 for details # This flag disables the broken optimisation to work around the bug @@ -60,8 +64,6 @@ macro(compile_flags) -Winit-self -Wnon-virtual-dtor - # Often parameters are unused, which is fine. - -Wno-unused-parameter # We use 'ABCD' multichar for SaveLoad chunks identifiers -Wno-multichar @@ -72,22 +74,6 @@ macro(compile_flags) -fno-strict-aliasing ) - # When we are a stable release (Release build + USE_ASSERTS not set), - # assertations are off, which trigger a lot of warnings. We disable - # these warnings for these releases. - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options( - "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>" - "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>" - "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>" - ) - else() - add_compile_options( - "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>" - "$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>" - ) - endif() - # Ninja processes the output so the output from the compiler # isn't directly to a terminal; hence, the default is # non-coloured output. We can override this to get nicely From c84fd3031786f7e67bb6dae4d084bfcd74945a66 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 17 Sep 2023 19:56:54 +0200 Subject: [PATCH 28/59] Codechange: Add missing 'override'. --- src/fontcache/spritefontcache.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fontcache/spritefontcache.h b/src/fontcache/spritefontcache.h index 4e710c1a93..628a6d08e1 100644 --- a/src/fontcache/spritefontcache.h +++ b/src/fontcache/spritefontcache.h @@ -23,16 +23,16 @@ private: public: SpriteFontCache(FontSize fs); ~SpriteFontCache(); - virtual void SetUnicodeGlyph(char32_t key, SpriteID sprite); - virtual void InitializeUnicodeGlyphMap(); - virtual void ClearFontCache(); - virtual const Sprite *GetGlyph(GlyphID key); - virtual uint GetGlyphWidth(GlyphID key); - virtual bool GetDrawGlyphShadow(); - virtual GlyphID MapCharToGlyph(char32_t key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } + void SetUnicodeGlyph(char32_t key, SpriteID sprite) override; + void InitializeUnicodeGlyphMap() override; + void ClearFontCache() override; + const Sprite *GetGlyph(GlyphID key) override; + uint GetGlyphWidth(GlyphID key) override; + bool GetDrawGlyphShadow() override; + GlyphID MapCharToGlyph(char32_t key) override { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } const void *GetFontTable(uint32_t, size_t &length) override { length = 0; return nullptr; } - virtual std::string GetFontName() { return "sprite"; } - virtual bool IsBuiltInFont() { return true; } + std::string GetFontName() override { return "sprite"; } + bool IsBuiltInFont() override { return true; } }; #endif /* SPRITEFONTCACHE_H */ From 6b586dddad06a50a115a5ab1db81a9791067fd39 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 17 Sep 2023 20:49:22 +0200 Subject: [PATCH 29/59] Cleanup: TransmitNotesOff is only called with buffer==_buffer. --- src/music/dmusic.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/music/dmusic.cpp b/src/music/dmusic.cpp index 346374d37f..1750aabe8c 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -565,19 +565,19 @@ static void TransmitStandardSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, static void TransmitNotesOff(IDirectMusicBuffer *buffer, REFERENCE_TIME block_time, REFERENCE_TIME cur_time) { for (int ch = 0; ch < 16; ch++) { - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0); - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0); - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0); } /* Performing a GM reset stops all sound and resets all parameters. */ - TransmitStandardSysex(_buffer, block_time + 20, MidiSysexMessage::ResetGM); - TransmitStandardSysex(_buffer, block_time + 30, MidiSysexMessage::RolandSetReverb); + TransmitStandardSysex(buffer, block_time + 20, MidiSysexMessage::ResetGM); + TransmitStandardSysex(buffer, block_time + 30, MidiSysexMessage::RolandSetReverb); /* Explicitly flush buffer to make sure the messages are processed, * as we want sound to stop immediately. */ - _port->PlayBuffer(_buffer); - _buffer->Flush(); + _port->PlayBuffer(buffer); + buffer->Flush(); /* Wait until message time has passed. */ Sleep(Clamp((block_time - cur_time) / MS_TO_REFTIME, 5, 1000)); From 48dc4219eac623a2db6151f6d00ce9f91e23c871 Mon Sep 17 00:00:00 2001 From: PeterN Date: Wed, 20 Sep 2023 08:56:53 +0100 Subject: [PATCH 30/59] Codechange: Don't pass GUI cargo filter constants to command system. (#11320) CMD_BUILD_VEHICLE expects CT_INVALID to indicate a new vehicle should not be refitted on build, but the code passed CF_NONE instead. CF_NONE has the same numeric value at CT_INVALID, so the test passed, but... --- src/build_vehicle_gui.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 707715a28e..6c5e5223e3 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1323,7 +1323,7 @@ struct BuildVehicleWindow : Window { void SelectEngine(EngineID engine) { CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; - if (cargo == CF_ANY) cargo = CF_NONE; + if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID; this->sel_engine = engine; this->SetBuyVehicleText(); @@ -1647,7 +1647,7 @@ struct BuildVehicleWindow : Window { EngineID sel_eng = this->sel_engine; if (sel_eng != INVALID_ENGINE) { CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; - if (cargo == CF_ANY || cargo == CF_ENGINES) cargo = CF_NONE; + if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID; if (this->vehicle_type == VEH_TRAIN && RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) { Command::Post(GetCmdBuildVehMsg(this->vehicle_type), CcBuildWagon, this->window_number, sel_eng, true, cargo, INVALID_CLIENT_ID); } else { From a0c6259e3356d73b47dceb99594abd9a67a7b377 Mon Sep 17 00:00:00 2001 From: PeterN Date: Wed, 20 Sep 2023 08:58:08 +0100 Subject: [PATCH 31/59] Codechange: Don't access cargo filter before it is initialized. (#11321) The cargo filter list is initialized during window OnInit, but the first build of the filtered list occurred before this. --- src/group_gui.cpp | 6 +++--- src/industry_gui.cpp | 3 ++- src/vehicle_gui.cpp | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/group_gui.cpp b/src/group_gui.cpp index c52153fe2f..ffd965590f 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -358,9 +358,6 @@ public: this->group_rename = INVALID_GROUP; this->group_over = INVALID_GROUP; - this->BuildVehicleList(); - this->SortVehicleList(); - this->groups.ForceRebuild(); this->groups.NeedResort(); this->BuildGroupList(vli.company); @@ -377,6 +374,9 @@ public: this->FinishInitNested(window_number); this->owner = vli.company; + + this->BuildVehicleList(); + this->SortVehicleList(); } ~VehicleGroupWindow() diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 8526a95c8b..c847a6eb6d 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -1624,10 +1624,11 @@ public: this->industries.SetListing(this->last_sorting); this->industries.SetSortFuncs(IndustryDirectoryWindow::sorter_funcs); this->industries.ForceRebuild(); - this->BuildSortIndustriesList(); this->FinishInitNested(0); + this->BuildSortIndustriesList(); + this->querystrings[WID_ID_FILTER] = &this->industry_editbox; this->industry_editbox.cancel_button = QueryString::ACTION_CLEAR; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 017dd1b33f..7010610d11 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1842,9 +1842,6 @@ public: this->vscroll = this->GetScrollbar(WID_VL_SCROLLBAR); - this->BuildVehicleList(); - this->SortVehicleList(); - /* Set up the window widgets */ this->GetWidget(WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype; @@ -1863,6 +1860,9 @@ public: this->FinishInitNested(window_number); if (this->vli.company != OWNER_NONE) this->owner = this->vli.company; + + this->BuildVehicleList(); + this->SortVehicleList(); } ~VehicleListWindow() From b9a1cb5d7c43b49679e4b39c2dbf4e94dd57c476 Mon Sep 17 00:00:00 2001 From: Joan Josep Date: Wed, 20 Sep 2023 20:22:37 +0200 Subject: [PATCH 32/59] Fix: Spelling of NIHAirport. (#11322) --- src/table/newgrf_debug_data.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 2c92db398c..eaa24a2347 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -533,7 +533,7 @@ static const NIVariable _niv_airports[] = { NIV_END() }; -class NIHAiport : public NIHelper { +class NIHAirport : public NIHelper { bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); } const void *GetInstance(uint index)const override { return Station::Get(index); } @@ -562,7 +562,7 @@ static const NIFeature _nif_airport = { nullptr, nullptr, _niv_airports, - new NIHAiport(), + new NIHAirport(), }; From 72323ae9e640c9a79a7ee8ccc5f42553817cf0a0 Mon Sep 17 00:00:00 2001 From: translators Date: Wed, 20 Sep 2023 18:38:51 +0000 Subject: [PATCH 33/59] Update: Translations from eints danish: 20 changes by bscargo --- src/lang/danish.txt | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 82bb7aaa9a..5b06aa7407 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -523,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Slet alle beske # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Landområde information +STR_ABOUT_MENU_HELP :Hjælp & manualer STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Tænd/Sluk konsol STR_ABOUT_MENU_AI_DEBUG :Computerspiller/spilscript debug @@ -2124,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Netværk STR_INTRO_GAME_OPTIONS :{BLACK}Opsætning STR_INTRO_HIGHSCORE :{BLACK} Topresultater +STR_INTRO_HELP :{BLACK}Hjælp og manualer STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Indstillinger STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF indstillinger STR_INTRO_ONLINE_CONTENT :{BLACK}Tjek Online Indhold @@ -2145,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Vælg 'l STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Sæt spillet op STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hvis topscoreliste +STR_INTRO_TOOLTIP_HELP :{BLACK}Få adgang til dokumentation og online ressourcer STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Skærm indstillinger STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Vis NewGRF-indstillinger STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Tjek for nyt og opdateret indhold til download @@ -2167,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Er du s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du sikker på, at du vil afslutte dette scenarie ? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Hjælp og manualer +STR_HELP_WINDOW_WEBSITES :{BLACK}Hjemmesider +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenter +STR_HELP_WINDOW_README :{BLACK}Læs mig +STR_HELP_WINDOW_CHANGELOG :{BLACK}Ændringslog +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Kendte Bugs +STR_HELP_WINDOW_LICENSE :{BLACK}Licens +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manual / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Anmeld en fejl +STR_HELP_WINDOW_COMMUNITY :{BLACK}Fællesskab # Cheat window STR_CHEATS :{WHITE}Snydefunktioner @@ -4701,6 +4715,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Indholdsfortegnelse +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Spring hurtigt til en sektion i den viste fil via denne liste +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Gå tilbage i navigationshistorikken +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Vend tilbage i navigationshistorikken STR_TEXTFILE_WRAP_TEXT :{WHITE}Ombryd tekst STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ombryd teksten i vinduet, så det hele passer uden at skulle rulle STR_TEXTFILE_VIEW_README :{BLACK}Se readme @@ -4711,6 +4730,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} ændringslog for {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licens for {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :Forhåndsvisning af undersøgelsesresultat +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD dokument '{STRING}' # Vehicle loading indicators From e0df9372472b0395a2f7670d5d7821ab821f8a86 Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 20 Sep 2023 21:23:42 +0200 Subject: [PATCH 34/59] Fix b5885295: NewGRF preset dropdown was broken. --- src/newgrf_gui.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 81fb85560b..8ecdb1d657 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1171,7 +1171,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { void OnDropdownSelect(int widget, int index) override { - if (widget >= 0) return; + if (widget != WID_NS_PRESET_LIST) return; if (!this->editable) return; ClearGRFConfigList(&this->actives); From 39e67b6f4c8f2fda4b88e1d5ae215fb78f16ac6a Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 20 Sep 2023 21:25:37 +0200 Subject: [PATCH 35/59] Codechange: Use existing widget ids instead of raw numbers. --- src/bootstrap_gui.cpp | 2 +- src/screenshot_gui.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 9859fb6b56..7933c60b1f 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -239,7 +239,7 @@ public: void DrawWidget(const Rect &r, int widget) const override { - if (widget != 0) return; + if (widget != WID_BAFD_QUESTION) return; DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER); } diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index 060eb4933e..a59fc14407 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -29,10 +29,9 @@ struct ScreenshotWindow : Window { void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override { - if (widget < 0) return; ScreenshotType st; switch (widget) { - default: + default: return; case WID_SC_TAKE: st = SC_VIEWPORT; break; case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break; case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break; From f40816503f59a3541a65686f3279c7e71bfcb8be Mon Sep 17 00:00:00 2001 From: frosch Date: Wed, 20 Sep 2023 21:26:42 +0200 Subject: [PATCH 36/59] Codechange: Add enum items for dynmically created setting dropdowns. --- src/game/game_gui.cpp | 6 +++--- src/newgrf_gui.cpp | 6 +++--- src/script/script_gui.cpp | 6 +++--- src/settings_gui.cpp | 20 +++++++++----------- src/widgets/game_widget.h | 2 ++ src/widgets/newgrf_widget.h | 2 ++ src/widgets/script_widget.h | 2 ++ src/widgets/settings_widget.h | 2 ++ 8 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index fd9e2c9957..faca456f13 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -314,7 +314,7 @@ struct GSConfigWindow : public Window { list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_GSC_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -367,14 +367,14 @@ struct GSConfigWindow : public Window { void OnDropdownSelect(int widget, int index) override { - if (widget >= 0) return; + if (widget != WID_GSC_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); SetValue(index); } void OnDropdownClose(Point, int widget, int, bool) override { - if (widget >= 0) return; + if (widget != WID_GSC_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 8ecdb1d657..9aab5e9b6f 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -395,7 +395,7 @@ struct NewGRFParametersWindow : public Window { list.emplace_back(new DropDownListStringItem(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_NP_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -453,7 +453,7 @@ struct NewGRFParametersWindow : public Window { void OnDropdownSelect(int widget, int index) override { - if (widget >= 0) return; + if (widget != WID_NP_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row); par_info.SetValue(this->grf_config, index); @@ -462,7 +462,7 @@ struct NewGRFParametersWindow : public Window { void OnDropdownClose(Point, int widget, int, bool) override { - if (widget >= 0) return; + if (widget != WID_NP_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 91e2f47e04..21033cbf9c 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -472,7 +472,7 @@ struct ScriptSettingsWindow : public Window { list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_SCRS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -526,14 +526,14 @@ struct ScriptSettingsWindow : public Window { void OnDropdownSelect(int widget, int index) override { - if (widget >= 0) return; + if (widget != WID_SCRS_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); SetValue(index); } void OnDropdownClose(Point, int widget, int, bool) override { - if (widget >= 0) return; + if (widget != WID_SCRS_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index e6fba68826..fd81ce74a1 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2394,7 +2394,7 @@ struct GameSettingsWindow : Window { list.emplace_back(new DropDownListStringItem(sd->str_val + i - sd->min, i, false)); } - ShowDropDownListAt(this, std::move(list), value, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), value, WID_GS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } this->SetDirty(); @@ -2526,23 +2526,21 @@ struct GameSettingsWindow : Window { this->InvalidateData(); break; - default: - if (widget < 0) { - /* Deal with drop down boxes on the panel. */ - assert(this->valuedropdown_entry != nullptr); - const IntSettingDesc *sd = this->valuedropdown_entry->setting; - assert(sd->flags & SF_GUI_DROPDOWN); + case WID_GS_SETTING_DROPDOWN: + /* Deal with drop down boxes on the panel. */ + assert(this->valuedropdown_entry != nullptr); + const IntSettingDesc *sd = this->valuedropdown_entry->setting; + assert(sd->flags & SF_GUI_DROPDOWN); - SetSettingValue(sd, index); - this->SetDirty(); - } + SetSettingValue(sd, index); + this->SetDirty(); break; } } void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override { - if (widget >= 0) { + if (widget != WID_GS_SETTING_DROPDOWN) { /* Normally the default implementation of OnDropdownClose() takes care of * a few things. We want that behaviour here too, but only for * "normal" dropdown boxes. The special dropdown boxes added for every diff --git a/src/widgets/game_widget.h b/src/widgets/game_widget.h index 5694bc4607..6ab78fa8e9 100644 --- a/src/widgets/game_widget.h +++ b/src/widgets/game_widget.h @@ -23,6 +23,8 @@ enum GSConfigWidgets { WID_GSC_CONTENT_DOWNLOAD = WID_GSC_TEXTFILE + TFT_CONTENT_END, ///< Download content button. WID_GSC_ACCEPT, ///< Accept ("Close") button WID_GSC_RESET, ///< Reset button. + + WID_GSC_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; #endif /* WIDGETS_GS_WIDGET_H */ diff --git a/src/widgets/newgrf_widget.h b/src/widgets/newgrf_widget.h index 03b81bb584..2d39665447 100644 --- a/src/widgets/newgrf_widget.h +++ b/src/widgets/newgrf_widget.h @@ -26,6 +26,8 @@ enum NewGRFParametersWidgets { WID_NP_RESET, ///< Reset button. WID_NP_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions. WID_NP_DESCRIPTION, ///< Multi-line description of a parameter. + + WID_NP_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #NewGRFWindow class. */ diff --git a/src/widgets/script_widget.h b/src/widgets/script_widget.h index 9c757e12fa..0566995f8d 100644 --- a/src/widgets/script_widget.h +++ b/src/widgets/script_widget.h @@ -29,6 +29,8 @@ enum ScriptSettingsWidgets { WID_SCRS_SCROLLBAR, ///< Scrollbar to scroll through all settings. WID_SCRS_ACCEPT, ///< Accept button. WID_SCRS_RESET, ///< Reset button. + + WID_SCRS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #ScriptDebugWindow class. */ diff --git a/src/widgets/settings_widget.h b/src/widgets/settings_widget.h index 5f372eaec5..f358e6ccda 100644 --- a/src/widgets/settings_widget.h +++ b/src/widgets/settings_widget.h @@ -64,6 +64,8 @@ enum GameSettingsWidgets { WID_GS_RESTRICT_TYPE, ///< Label upfront to the type drop-down box to restrict the list of settings to show WID_GS_RESTRICT_DROPDOWN, ///< The drop down box to restrict the list of settings WID_GS_TYPE_DROPDOWN, ///< The drop down box to choose client/game/company/all settings + + WID_GS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #CustomCurrencyWindow class. */ From 2eacf36d0a6e3a327ecba227e66e3d6a8bf1ff1a Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 20 Sep 2023 20:59:25 +0100 Subject: [PATCH 37/59] Codechange: List fallback station names by ID instead of magic number. This improves readability and intention of the station name generator. --- src/station_cmd.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 2ab50585e9..04b14dc37c 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -354,7 +354,23 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n (TileX(tile) < TileX(t->xy)) + (TileY(tile) < TileY(t->xy)) * 2]; - tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30)); + /** Bitmask of remaining station names that can be used when a more specific name has not been used. */ + static const uint32_t fallback_names = ( + (1U << M(STR_SV_STNAME_NORTH)) | + (1U << M(STR_SV_STNAME_SOUTH)) | + (1U << M(STR_SV_STNAME_EAST)) | + (1U << M(STR_SV_STNAME_WEST)) | + (1U << M(STR_SV_STNAME_TRANSFER)) | + (1U << M(STR_SV_STNAME_HALT)) | + (1U << M(STR_SV_STNAME_EXCHANGE)) | + (1U << M(STR_SV_STNAME_ANNEXE)) | + (1U << M(STR_SV_STNAME_SIDINGS)) | + (1U << M(STR_SV_STNAME_BRANCH)) | + (1U << M(STR_SV_STNAME_UPPER)) | + (1U << M(STR_SV_STNAME_LOWER)) + ); + + tmp = free_names & fallback_names; return (tmp == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME + FindFirstBit(tmp)); } #undef M From aeaa552385cd54f61a41ee5f1762c477e2ee1c73 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 20 Sep 2023 20:59:31 +0100 Subject: [PATCH 38/59] Codechange: Use std::bitset instead of bool array. This avoids use of C-style pointers and memset. --- src/station_cmd.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 04b14dc37c..fa98649614 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -67,6 +67,8 @@ #include "table/strings.h" +#include + #include "safeguards.h" /** @@ -216,7 +218,7 @@ enum StationNaming { /** Information to handle station action 0 property 24 correctly */ struct StationNameInformation { uint32_t free_names; ///< Current bitset of free names (we can remove names). - bool *indtypes; ///< Array of bools telling whether an industry type has been found. + std::bitset indtypes; ///< Bit set indicating when an industry type has been found. }; /** @@ -257,19 +259,18 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n const Town *t = st->town; uint32_t free_names = UINT32_MAX; - bool indtypes[NUM_INDUSTRYTYPES]; - memset(indtypes, 0, sizeof(indtypes)); + StationNameInformation sni{}; for (const Station *s : Station::Iterate()) { if (s != st && s->town == t) { if (s->indtype != IT_INVALID) { - indtypes[s->indtype] = true; + sni.indtypes[s->indtype] = true; StringID name = GetIndustrySpec(s->indtype)->station_name; if (name != STR_UNDEFINED) { /* Filter for other industrytypes with the same name */ for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { const IndustrySpec *indsp = GetIndustrySpec(it); - if (indsp->enabled && indsp->station_name == name) indtypes[it] = true; + if (indsp->enabled && indsp->station_name == name) sni.indtypes[it] = true; } } continue; @@ -285,7 +286,7 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n } TileIndex indtile = tile; - StationNameInformation sni = { free_names, indtypes }; + sni.free_names = free_names; if (CircularTileSearch(&indtile, 7, FindNearIndustryName, &sni)) { /* An industry has been found nearby */ IndustryType indtype = GetIndustryType(indtile); From 122bfa2afd59776675047136fa7fe579ce866ad1 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Wed, 20 Sep 2023 20:59:32 +0100 Subject: [PATCH 39/59] Codechange: Use less locals for station free names bitmask. --- src/station_cmd.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index fa98649614..d461ade2ba 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -257,9 +257,9 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n }; const Town *t = st->town; - uint32_t free_names = UINT32_MAX; StationNameInformation sni{}; + sni.free_names = UINT32_MAX; for (const Station *s : Station::Iterate()) { if (s != st && s->town == t) { @@ -280,13 +280,12 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n if (str == M(STR_SV_STNAME_FOREST)) { str = M(STR_SV_STNAME_WOODS); } - ClrBit(free_names, str); + ClrBit(sni.free_names, str); } } } TileIndex indtile = tile; - sni.free_names = free_names; if (CircularTileSearch(&indtile, 7, FindNearIndustryName, &sni)) { /* An industry has been found nearby */ IndustryType indtype = GetIndustryType(indtile); @@ -299,14 +298,13 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n } /* Oil rigs/mines name could be marked not free by looking for a near by industry. */ - free_names = sni.free_names; /* check default names */ - uint32_t tmp = free_names & _gen_station_name_bits[name_class]; + uint32_t tmp = sni.free_names & _gen_station_name_bits[name_class]; if (tmp != 0) return STR_SV_STNAME + FindFirstBit(tmp); /* check mine? */ - if (HasBit(free_names, M(STR_SV_STNAME_MINES))) { + if (HasBit(sni.free_names, M(STR_SV_STNAME_MINES))) { if (CountMapSquareAround(tile, CMSAMine) >= 2) { return STR_SV_STNAME_MINES; } @@ -314,20 +312,20 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n /* check close enough to town to get central as name? */ if (DistanceMax(tile, t->xy) < 8) { - if (HasBit(free_names, M(STR_SV_STNAME))) return STR_SV_STNAME; + if (HasBit(sni.free_names, M(STR_SV_STNAME))) return STR_SV_STNAME; - if (HasBit(free_names, M(STR_SV_STNAME_CENTRAL))) return STR_SV_STNAME_CENTRAL; + if (HasBit(sni.free_names, M(STR_SV_STNAME_CENTRAL))) return STR_SV_STNAME_CENTRAL; } /* Check lakeside */ - if (HasBit(free_names, M(STR_SV_STNAME_LAKESIDE)) && + if (HasBit(sni.free_names, M(STR_SV_STNAME_LAKESIDE)) && DistanceFromEdge(tile) < 20 && CountMapSquareAround(tile, CMSAWater) >= 5) { return STR_SV_STNAME_LAKESIDE; } /* Check woods */ - if (HasBit(free_names, M(STR_SV_STNAME_WOODS)) && ( + if (HasBit(sni.free_names, M(STR_SV_STNAME_WOODS)) && ( CountMapSquareAround(tile, CMSATree) >= 8 || CountMapSquareAround(tile, IsTileForestIndustry) >= 2) ) { @@ -338,9 +336,9 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n int z = GetTileZ(tile); int z2 = GetTileZ(t->xy); if (z < z2) { - if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY; + if (HasBit(sni.free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY; } else if (z > z2) { - if (HasBit(free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS; + if (HasBit(sni.free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS; } /* check direction compared to town */ @@ -351,7 +349,7 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n ~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ), }; - free_names &= _direction_and_table[ + sni.free_names &= _direction_and_table[ (TileX(tile) < TileX(t->xy)) + (TileY(tile) < TileY(t->xy)) * 2]; @@ -371,8 +369,8 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n (1U << M(STR_SV_STNAME_LOWER)) ); - tmp = free_names & fallback_names; - return (tmp == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME + FindFirstBit(tmp)); + sni.free_names &= fallback_names; + return (sni.free_names == 0) ? STR_SV_STNAME_FALLBACK : (STR_SV_STNAME + FindFirstBit(sni.free_names)); } #undef M From 6b7537646d0e0300fe70662f3b755fdb37d2ba84 Mon Sep 17 00:00:00 2001 From: Joan Josep Date: Wed, 20 Sep 2023 23:54:34 +0200 Subject: [PATCH 40/59] Fix: Allow NewGRF inspection of road tiles. (#11323) --- src/lang/english.txt | 1 + src/newgrf_debug_gui.cpp | 2 +- src/table/newgrf_debug_data.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index a646f503ee..8f2129a22e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING1} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 0fc29e5715..c7fee2751b 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -775,7 +775,7 @@ GrfSpecFeature GetGrfSpecFeature(TileIndex tile) switch (GetTileType(tile)) { default: return GSF_INVALID; case MP_RAILWAY: return GSF_RAILTYPES; - case MP_ROAD: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_INVALID; + case MP_ROAD: return IsLevelCrossing(tile) ? GSF_RAILTYPES : GSF_ROADTYPES; case MP_HOUSE: return GSF_HOUSES; case MP_INDUSTRY: return GSF_INDUSTRYTILES; case MP_OBJECT: return GSF_OBJECTS; diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index eaa24a2347..0cb4e96277 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -632,7 +632,7 @@ class NIHRoadType : public NIHelper { uint GetParent(uint) const override { return UINT32_MAX; } const void *GetInstance(uint) const override { return nullptr; } const void *GetSpec(uint) const override { return nullptr; } - void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE, INVALID_STRING_ID, index); } + void SetStringParameters(uint index) const override { this->SetObjectAtStringParameters(STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE, INVALID_STRING_ID, index); } uint32_t GetGRFID(uint) const override { return 0; } uint Resolve(uint index, uint var, uint param, bool *avail) const override From cef6a5f79c28cee1030c08ec19a87667338ce508 Mon Sep 17 00:00:00 2001 From: PeterN Date: Thu, 21 Sep 2023 07:42:49 +0100 Subject: [PATCH 41/59] Fix #11326: Update autoreplace scrollbar count after clearing engine list. (#11327) --- src/autoreplace_gui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 2a0f49e1c9..467e64d4b8 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -229,6 +229,7 @@ class ReplaceVehicleWindow : public Window { /* Always empty the right engines list when nothing is selected in the left engines list */ this->engines[1].clear(); this->sel_engine[1] = INVALID_ENGINE; + this->vscroll[1]->SetCount(this->engines[1].size()); } else { if (this->reset_sel_engine && this->sel_engine[0] != INVALID_ENGINE) { /* Select the current replacement for sel_engine[0]. */ From 6d675c8acfe7f854a740118c1aba300b107007b5 Mon Sep 17 00:00:00 2001 From: PeterN Date: Thu, 21 Sep 2023 13:24:53 +0100 Subject: [PATCH 42/59] Fix: #11329: Don't assert vehicle list length is non-zero when only asked to set string parameter. (#11330) Since #11321, the vehicle list is not yet initialized when SetStringParameters is called, so a test that the vehicle list size is zero is triggered. However, doing this check in the SetStringParameters function is a bit out of its remit, so just remove it. --- src/vehicle_gui.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 7010610d11..d5f602de91 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1936,11 +1936,6 @@ public: case WID_VL_CAPTION_SHARED_ORDERS: { switch (this->vli.type) { case VL_SHARED_ORDERS: // Shared Orders - if (this->vehicles.size() == 0) { - /* We can't open this window without vehicles using this order - * and we should close the window when deleting the order. */ - NOT_REACHED(); - } SetDParam(0, this->vehicles.size()); break; From 69ee38bd4320fd2d27de6c143febb6faaff478db Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 21 Sep 2023 08:29:10 +0100 Subject: [PATCH 43/59] Codechange: Use GetAcceptanceMask() instead of duplicating it. --- src/newgrf_station.cpp | 7 +------ src/station_cmd.cpp | 2 +- src/station_func.h | 1 + src/station_gui.cpp | 6 +----- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 35202de1ef..16106dc1c3 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -391,12 +391,7 @@ uint32_t Station::GetNewGRFVariable(const ResolverObject &object, byte variable, { switch (variable) { case 0x48: { // Accepted cargo types - CargoID cargo_type; - uint32_t value = 0; - - for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) { - if (HasBit(this->goods[cargo_type].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(value, cargo_type); - } + uint32_t value = GetAcceptanceMask(this); return value; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index d461ade2ba..feb783bd74 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -492,7 +492,7 @@ void ClearAllStationCachedNames() * @param st Station to query * @return the expected mask */ -static CargoTypes GetAcceptanceMask(const Station *st) +CargoTypes GetAcceptanceMask(const Station *st) { CargoTypes mask = 0; diff --git a/src/station_func.h b/src/station_func.h index 6b1fbd0413..ad3b60b7ae 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -30,6 +30,7 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad); CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted = nullptr); void UpdateStationAcceptance(Station *st, bool show_msg); +CargoTypes GetAcceptanceMask(const Station *st); const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 593acb4ef7..befcdbc221 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -1835,11 +1835,7 @@ struct StationViewWindow : public Window { const Station *st = Station::Get(this->window_number); Rect tr = r.Shrink(WidgetDimensions::scaled.framerect); - CargoTypes cargo_mask = 0; - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (HasBit(st->goods[i].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(cargo_mask, i); - } - SetDParam(0, cargo_mask); + SetDParam(0, GetAcceptanceMask(st)); int bottom = DrawStringMultiLine(tr.left, tr.right, tr.top, INT32_MAX, STR_STATION_VIEW_ACCEPTS_CARGO); return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, FONT_HEIGHT_NORMAL); } From 398c7e5f9d9ff8c786cac8fe0134ae2e4596dbab Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 21 Sep 2023 08:38:46 +0100 Subject: [PATCH 44/59] Codechange: Use new function to get a bitmask of empty cargo types. --- src/newgrf_roadstop.cpp | 11 ++--------- src/newgrf_station.cpp | 11 ++--------- src/station_cmd.cpp | 15 +++++++++++++++ src/station_func.h | 1 + 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index 983bc0d06e..1055ea84bb 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -385,15 +385,8 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri uint32_t whole_reseed = 0; - CargoTypes empty_mask = 0; - if (trigger == RSRT_CARGO_TAKEN) { - /* Create a bitmask of completely empty cargo types to be matched */ - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (st->goods[i].cargo.TotalCount() == 0) { - SetBit(empty_mask, i); - } - } - } + /* Bitmask of completely empty cargo types to be matched. */ + CargoTypes empty_mask = (trigger == RSRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0; uint32_t used_triggers = 0; auto process_tile = [&](TileIndex cur_tile) { diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 16106dc1c3..5fb5ceb752 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -962,15 +962,8 @@ void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRan uint32_t whole_reseed = 0; ETileArea area = ETileArea(st, trigger_tile, tas[trigger]); - CargoTypes empty_mask = 0; - if (trigger == SRT_CARGO_TAKEN) { - /* Create a bitmask of completely empty cargo types to be matched */ - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (st->goods[i].cargo.TotalCount() == 0) { - SetBit(empty_mask, i); - } - } - } + /* Bitmask of completely empty cargo types to be matched. */ + CargoTypes empty_mask = (trigger == SRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0; /* Store triggers now for var 5F */ SetBit(st->waiting_triggers, trigger); diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index feb783bd74..12c30a33b8 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -502,6 +502,21 @@ CargoTypes GetAcceptanceMask(const Station *st) return mask; } +/** + * Get a mask of the cargo types that are empty at the station. + * @param st Station to query + * @return the empty mask + */ +CargoTypes GetEmptyMask(const Station *st) +{ + CargoTypes mask = 0; + + for (CargoID i = 0; i < NUM_CARGO; i++) { + if (st->goods[i].cargo.TotalCount() == 0) SetBit(mask, i); + } + return mask; +} + /** * Items contains the two cargo names that are to be accepted or rejected. * msg is the string id of the message to display. diff --git a/src/station_func.h b/src/station_func.h index ad3b60b7ae..8e72a945f7 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -31,6 +31,7 @@ CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, Cargo void UpdateStationAcceptance(Station *st, bool show_msg); CargoTypes GetAcceptanceMask(const Station *st); +CargoTypes GetEmptyMask(const Station *st); const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); From bec36c1f9853000a2814ce4c8b690984339ebc08 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Thu, 21 Sep 2023 20:54:01 +0200 Subject: [PATCH 45/59] Cleanup ba67f39: CodeQL's dependency was forgotten to be removed --- .github/workflows/codeql.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index fbab30ba54..b9b083568c 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -42,7 +42,6 @@ jobs: liblzma-dev \ liblzo2-dev \ libsdl2-dev \ - nlohmann-json3-dev \ zlib1g-dev \ # EOF echo "::endgroup::" From f8303b03970c9e2df001a36dc4321d6d9da906c6 Mon Sep 17 00:00:00 2001 From: translators Date: Fri, 22 Sep 2023 18:37:34 +0000 Subject: [PATCH 46/59] Update: Translations from eints english (au): 1 change by krysclarke russian: 1 change by Ln-Wolf danish: 1 change by bscargo dutch: 1 change by Afoklala french: 1 change by ottdfevr portuguese: 1 change by azulcosta polish: 68 changes by pAter-exe --- src/lang/danish.txt | 1 + src/lang/dutch.txt | 1 + src/lang/english_AU.txt | 1 + src/lang/french.txt | 1 + src/lang/polish.txt | 115 ++++++++++++++++++++++++---------------- src/lang/portuguese.txt | 1 + src/lang/russian.txt | 1 + 7 files changed, 74 insertions(+), 47 deletions(-) diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 5b06aa7407..0f0951da53 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspicer STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} ved {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objekt STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Jernbanetype +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Vej type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variabel 60+x parameter (hexadecimal) diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 1b431a37de..7f370dd7d1 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} bij {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Spoortype +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Wegtype STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parameter 60+x voor NewGRF-variabele (hexadecimaal) diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index c51d9ff405..9902b3158e 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/lang/french.txt b/src/lang/french.txt index 2f8a48c07e..4a0ae2b3be 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} à {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objet STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Type de rail +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Type de route STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Paramètre de variable NewGRF 60+x (héxadecimal) diff --git a/src/lang/polish.txt b/src/lang/polish.txt index 8e3b26fe87..4dac9495ac 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -902,6 +902,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Usuń wszystkie # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informacje o terenie +STR_ABOUT_MENU_HELP :Pomoc i instrukcje STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Przełącz konsolę STR_ABOUT_MENU_AI_DEBUG :Debugowanie SI / Game Script @@ -1023,7 +1024,7 @@ STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP :{BLACK}Kliknij # Company league window STR_COMPANY_LEAGUE_TABLE_CAPTION :{WHITE}Ranking firm -STR_COMPANY_LEAGUE_COMPANY_NAME :{ORANGE}{COMPANY} {BLACK}{COMPANY_NUM} '{STRING}' +STR_COMPANY_LEAGUE_COMPANY_NAME :{ORANGE}{COMPANY} {BLACK}{COMPANY_NUM} „{STRING}” STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER :Inżynier STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRAFFIC_MANAGER :Administrator Ruchu STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRANSPORT_COORDINATOR :Koordynator Transportu @@ -1123,9 +1124,9 @@ STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE :Magnat STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Potentat STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Tycoon Stulecia STR_HIGHSCORE_NAME :{PRESIDENT_NAME}, {COMPANY} -STR_HIGHSCORE_STATS :{BIG_FONT}'{STRING}' ({COMMA}) -STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} osiąga status: '{STRING}'! -STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} z {COMPANY} osiągnęło status '{STRING}'! +STR_HIGHSCORE_STATS :{BIG_FONT}„{STRING}” ({COMMA}) +STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} osiąga status: „{STRING}”! +STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} z {COMPANY} osiągnęło status „{STRING}”! # Smallmap window STR_SMALLMAP_CAPTION :{WHITE}Mapa - {STRING} @@ -1231,10 +1232,10 @@ STR_NEWS_AIRCRAFT_CRASH :{BIG_FONT}{BLAC STR_NEWS_PLANE_CRASH_OUT_OF_FUEL :{BIG_FONT}{BLACK}Wypadek lotniczy!{}Samolot rozbił się z powodu braku paliwa, zginęł{P 0 a y o} {COMMA} os{P oba oby ób}! STR_NEWS_DISASTER_ZEPPELIN :{BIG_FONT}{BLACK}Katastrofa Zeppelina na {STATION}! -STR_NEWS_DISASTER_SMALL_UFO :{BIG_FONT}{BLACK}Pojazd zniszczony w kolizji z 'UFO'! +STR_NEWS_DISASTER_SMALL_UFO :{BIG_FONT}{BLACK}Pojazd zniszczony w kolizji z „UFO”! STR_NEWS_DISASTER_AIRPLANE_OIL_REFINERY :{BIG_FONT}{BLACK}Eksplozja rafinerii w pobliżu {TOWN}! STR_NEWS_DISASTER_HELICOPTER_FACTORY :{BIG_FONT}{BLACK}Fabryka zniszczona w podejrzanych okolicznościach w pobliżu {TOWN}! -STR_NEWS_DISASTER_BIG_UFO :{BIG_FONT}{BLACK}'UFO' wylądowało w pobliżu {TOWN}! +STR_NEWS_DISASTER_BIG_UFO :{BIG_FONT}{BLACK}„UFO” wylądowało w pobliżu {TOWN}! STR_NEWS_DISASTER_COAL_MINE_SUBSIDENCE :{BIG_FONT}{BLACK}Tąpnięcie przy kopalni pozostawiło pas zniszczenia blisko {TOWN}! STR_NEWS_DISASTER_FLOOD_VEHICLE :{BIG_FONT}{BLACK}Powódź!{}Przynajmniej {COMMA} zaginęło lub utonęło w czasie powodzi! @@ -1571,7 +1572,7 @@ STR_CITY_APPROVAL_TOLERANT :Tolerancyjne STR_CITY_APPROVAL_HOSTILE :Wrogie STR_CITY_APPROVAL_PERMISSIVE :Przyjazne (bez wpływu na działania firmy) -STR_WARNING_NO_SUITABLE_AI :{WHITE}Brak pasujących SI...{}Możesz pobrać wszystkie SI przez system "Dodatki online" +STR_WARNING_NO_SUITABLE_AI :{WHITE}Brak pasujących SI...{}Możesz pobrać wszystkie SI przez przeglądarkę „Dodatków Online” # Settings tree window STR_CONFIG_SETTING_TREE_CAPTION :{WHITE}Ustawienia @@ -1680,7 +1681,7 @@ STR_CONFIG_SETTING_CITY_APPROVAL :Nastawienie wł STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT :Wybierz, jak bardzo hałas i niszczenie środowiska przez firmy wpływają na ich ocenę w mieście i na dalsze działania związane z budową na jego obszarze STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT :Limit wysokości mapy: {STRING} -STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT :Ustawia limit wysokości mapy. Z ustawieniem "(automatyczna)" odpowiednia wartość zostanie dobrana po wygenerowaniu terenu +STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT :Ustawia limit wysokości mapy. Z ustawieniem „(automatyczna)” odpowiednia wartość zostanie dobrana po wygenerowaniu terenu STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_VALUE :{NUM} ###setting-zero-is-special STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_AUTO :(automatyczna) @@ -1759,7 +1760,7 @@ STR_CONFIG_SETTING_SIGNALSIDE_RIGHT :Po prawej STR_CONFIG_SETTING_SHOWFINANCES :Pokazuj okno finansów na koniec roku: {STRING} STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :Jeśli włączone, to okienko finansowe pokazuje się na zakończenie każdego roku, by ułatwić śledzenie sytuacji finansowej firmy -STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Nowe polecenia są domyślnie 'bez zatrzymywania się': {STRING} +STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Nowe polecenia są domyślnie „bez zatrzymywania się”: {STRING} STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :Normalnie pojazd zatrzyma się na każdej stacji, przez którą przejeżdża. Po włączeniu tej opcji, pojazd przejedzie do swojego celu bez zatrzymywania się. Zwróć uwagę na to, że to ustawienie ma wpływ tylko na nowe polecenia. Pojedyncze polecenia mogą być ustalane bez względu na wartość tej opcji STR_CONFIG_SETTING_STOP_LOCATION :Nowe rozkazy pociągu kończą się domyślnie na {STRING} peronu @@ -1894,7 +1895,7 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :Maksymalna odle STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Rafinerie są budowane tylko w pobliżu krawędzi map, to znaczy na wybrzeżach dla map wyspiarskich. To ustawienie pozwala ograniczyć jak daleko od krawędzi mapy mogą być budowane rafinerie i platformy wiertnicze. Na mapach większych niż 256 pól, wartość ta jest skalowana w górę. STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Wysokość granicy wiecznych śniegów: {STRING} -STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wysokość linii śniegu w klimacie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana wyłącznie poprzez Edytor scenariusza, normalnie jest obliczana za pomocą ustawienia "pokrycia śniegiem" +STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wysokość linii śniegu w klimacie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana poprzez Edytor Scenariuszy, w innym przypadku jest obliczana za pomocą ustawienia „pokrycie śniegiem” STR_CONFIG_SETTING_SNOW_COVERAGE :Pokrycie śniegiem: {STRING} STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Ustawia przybliżoną ilość śniegu w krajobrazie arktycznym. Śnieg wpływa również wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy. Teren tuż ponad poziomem morza jest zawsze bez śniegu @@ -1919,7 +1920,7 @@ STR_CONFIG_SETTING_RIVER_AMOUNT :Liczba rzek: {S STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Określa liczbę rzek na mapie STR_CONFIG_SETTING_TREE_PLACER :Algorytm rozmieszczenia drzew: {STRING} -STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Metoda generowania terenów zalesionych. Algorytm "Oryginalny" rozmieszcza drzewa równomiernie na całej mapie, a "Ulepszony" gromadzi je w skupiska +STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Metoda generowania terenów zalesionych. Algorytm „oryginalny” rozmieszcza drzewa równomiernie na całej mapie, a „ulepszony” gromadzi je w skupiska ###length 3 STR_CONFIG_SETTING_TREE_PLACER_NONE :Brak STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :Oryginalny @@ -2009,7 +2010,7 @@ STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK_FOCUS :Pojedyncze klik STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK :Pojedyncze kliknięcie (natychmiast) STR_CONFIG_SETTING_USE_RELAY_SERVICE :Używanie usługi przekaźnika: {STRING} -STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT :Jeśli nawiązanie połączenia z serwerem nie powiedzie się, można użyć usługi przekaźnika do nawiązania połączenia. „Nigdy" nie zezwoli na to, „pytaj” najpierw zapyta, „zezwól” pozwoli na to bez pytania +STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT :Jeśli nawiązanie połączenia z serwerem nie powiedzie się, można użyć usługi przekaźnika do nawiązania połączenia. „Nigdy” nie zezwoli na to, „pytaj” najpierw zapyta, „zezwól” pozwoli na to bez pytania ###length 3 STR_CONFIG_SETTING_USE_RELAY_SERVICE_NEVER :Nigdy STR_CONFIG_SETTING_USE_RELAY_SERVICE_ASK :Pytaj @@ -2029,11 +2030,11 @@ STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_NO :Nie STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES :Tak STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES_EXCEPT_STICKY :Tak, z wyjątkiem przypiętych -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :Użyj {STRING} formatu daty dla nazw zapisów gry +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :Użyj daty w formacie {STRING} dla nazw zapisów gry STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_HELPTEXT :Format daty w nazwach plików zapisu gry ###length 3 -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :długiego (31 grudnia 2008) -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT :krótkiego (31-12-2008) +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :długim (31 grudnia 2008) +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT :krótkim (31-12-2008) STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_ISO :ISO (2008-12-31) STR_CONFIG_SETTING_PAUSE_ON_NEW_GAME :Automatycznie włącz pauzę przy rozpoczęciu nowej gry: {STRING} @@ -2060,10 +2061,10 @@ STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Pokazuj przyjaz STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Wyświetlanie przewidywanego przyjazdu i odjazdu w rozkładach STR_CONFIG_SETTING_QUICKGOTO :Szybkie tworzenie poleceń pojazdu: {STRING} -STR_CONFIG_SETTING_QUICKGOTO_HELPTEXT :Po wybraniu stacji docelowej automatycznie włącz ponownie narzędzie 'idź do' +STR_CONFIG_SETTING_QUICKGOTO_HELPTEXT :Po wybraniu stacji docelowej automatycznie włącz ponownie narzędzie „idź do” STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE :Domyślny typ torów: {STRING} -STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_HELPTEXT :Rodzaj torów wybierany przy rozpoczęciu lub załadowaniu gry. 'Pierwszy dostępny' wybiera najstarszy rodzaj torów, 'najnowszy' wybiera najnowszy rodzaj torów, a 'najczęściej używany' wybiera ten, który jest używany najczęściej +STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_HELPTEXT :Rodzaj torów wybierany przy rozpoczęciu lub załadowaniu gry. „Pierwszy dostępny” wybiera najstarszy rodzaj torów, „najnowszy” wybiera najnowszy rodzaj torów, a „najczęściej używany” wybiera ten, który jest używany najczęściej ###length 3 STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_FIRST :pierwszy dostępny STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_LAST :najnowszy @@ -2469,21 +2470,21 @@ STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Zmiana w # Config errors STR_CONFIG_ERROR :{WHITE}Błąd w pliku konfiguracyjnym -STR_CONFIG_ERROR_ARRAY :{WHITE}... błąd w tablicy '{STRING}' -STR_CONFIG_ERROR_INVALID_VALUE :{WHITE}... nieprawidłowa wartość '{STRING}' dla '{STRING}' -STR_CONFIG_ERROR_TRAILING_CHARACTERS :{WHITE}... zbędne znaki na końcu ustawienia '{STRING}' -STR_CONFIG_ERROR_DUPLICATE_GRFID :{WHITE}... ignorowanie NewGRF-a '{STRING}': zduplikowany GRF ID z '{STRING}' -STR_CONFIG_ERROR_INVALID_GRF :{WHITE}... pominięcie nieprawidłowych NewGRF-ów '{STRING}': {STRING} +STR_CONFIG_ERROR_ARRAY :{WHITE}... błąd w tablicy „{STRING}” +STR_CONFIG_ERROR_INVALID_VALUE :{WHITE}... nieprawidłowa wartość „{STRING}” dla „{STRING}” +STR_CONFIG_ERROR_TRAILING_CHARACTERS :{WHITE}... zbędne znaki na końcu ustawienia „{STRING}” +STR_CONFIG_ERROR_DUPLICATE_GRFID :{WHITE}... ignorowanie NewGRF-a „{STRING}”: zduplikowany GRF ID z „{STRING}” +STR_CONFIG_ERROR_INVALID_GRF :{WHITE}... pominięcie nieprawidłowych NewGRF-ów „{STRING}”: {STRING} STR_CONFIG_ERROR_INVALID_GRF_NOT_FOUND :nie znaleziono STR_CONFIG_ERROR_INVALID_GRF_UNSAFE :{G=n}niebezpieczne w stałym użyciu STR_CONFIG_ERROR_INVALID_GRF_SYSTEM :systemowe NewGRF STR_CONFIG_ERROR_INVALID_GRF_INCOMPATIBLE :niezgodne z tą wersją OpenTTD STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN :nieznany -STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... poziom kompresji '{STRING}' nie jest poprawny -STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM :{WHITE}... format zapisu gry '{STRING}' jest niedostępny. Powracanie do '{STRING}' -STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Graphics '{STRING}': nie odnaleziono -STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Sounds '{STRING}': nie odnaleziono -STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignoruję zestaw Base Music '{STRING}': nie odnaleziono +STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... poziom kompresji „{STRING}” jest niepoprawny +STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM :{WHITE}... format zapisu gry „{STRING}” jest niedostępny. Powracanie do „{STRING}” +STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Graphics „{STRING}”: nie odnaleziono +STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Sounds „{STRING}”: nie odnaleziono +STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignoruję zestaw Base Music „{STRING}”: nie odnaleziono STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Brak pamięci STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Nie powiodła się rezerwacja pamięci cache dla sprite'ów od wielkości {BYTES}. Pamięć cache sprite'ów została zredukowana do {BYTES}. Obniży to wydajność OpenTTD. By zmniejszyć zapotrzebowanie pamięci, możesz spróbować wyłączyć grafikę 32bpp i/lub poziomy zbliżenia @@ -2504,9 +2505,10 @@ STR_INTRO_MULTIPLAYER :{BLACK}Gra wiel STR_INTRO_GAME_OPTIONS :{BLACK}Opcje gry STR_INTRO_HIGHSCORE :{BLACK}Tabela wyników +STR_INTRO_HELP :{BLACK}Pomoc i Instrukcje STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Ustawienia STR_INTRO_NEWGRF_SETTINGS :{BLACK}Ustawienia NewGRF -STR_INTRO_ONLINE_CONTENT :{BLACK}Sprawdź dodatki online +STR_INTRO_ONLINE_CONTENT :{BLACK}Sprawdź Dodatki Online STR_INTRO_AI_SETTINGS :{BLACK}Ustawienia SI STR_INTRO_GAMESCRIPT_SETTINGS :{BLACK}Ustawienia Game Script STR_INTRO_QUIT :{BLACK}Wyjście @@ -2525,6 +2527,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Wybierz STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Wyświetl opcje gry STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Wyświetl tabelę wyników +STR_INTRO_TOOLTIP_HELP :{BLACK}Uzyskaj dostęp do dokumentacji i zasobów online STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Wyświetl ustawienia gry STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Wyświetl ustawienia NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Poszukaj nowych lub zaktualizowanych dodatków do pobrania @@ -2547,6 +2550,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Czy na STR_ABANDON_SCENARIO_QUERY :{YELLOW}Czy na pewno chcesz porzucić ten scenariusz? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Pomoc i Instrukcje +STR_HELP_WINDOW_WEBSITES :{BLACK}Strony internetowe +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenty +STR_HELP_WINDOW_README :{BLACK}Plik „readme” +STR_HELP_WINDOW_CHANGELOG :{BLACK}Lista Zmian +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Znane Błędy +STR_HELP_WINDOW_LICENSE :{BLACK}Licencja +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Podręcznik / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Zgłoś Błąd +STR_HELP_WINDOW_COMMUNITY :{BLACK}Społeczność # Cheat window STR_CHEATS :{WHITE}Oszustwa @@ -2623,7 +2637,7 @@ STR_FACE_FACECODE :{BLACK}Numer tw STR_FACE_FACECODE_TOOLTIP :{BLACK}Obejrzyj i/lub ustaw numer twarzy prezesa firmy STR_FACE_FACECODE_CAPTION :{WHITE}Obejrzyj i/lub ustaw numer twarzy prezesa STR_FACE_FACECODE_SET :{WHITE}Ustawiono nowy numer twarzy gracza -STR_FACE_FACECODE_ERR :{WHITE}Nie można ustawić numeru twarzy prezesa - musi być liczbą pomiędzy 0 a 4'294'967'295! +STR_FACE_FACECODE_ERR :{WHITE}Nie można ustawić numeru twarzy prezesa - musi być liczbą pomiędzy 0 a 4{NBSP}294{NBSP}967{NBSP}295! STR_FACE_SAVE :{BLACK}Zapisz STR_FACE_SAVE_TOOLTIP :{BLACK}Zapisz ulubioną twarz STR_FACE_SAVE_DONE :{WHITE}Ta twarz będzie zapisana w pliku konfiguracyjnym OpenTTD jako twoja ulubiona @@ -2858,7 +2872,7 @@ STR_NETWORK_CHAT_CLIENT :[Prywatna] {STR STR_NETWORK_CHAT_TO_CLIENT :[Prywatna] Do {STRING}: {WHITE}{STRING} STR_NETWORK_CHAT_ALL :[Wszyscy] {STRING}: {WHITE}{STRING} STR_NETWORK_CHAT_EXTERNAL :[{3:STRING}] {0:STRING}: {WHITE}{1:STRING} -STR_NETWORK_CHAT_OSKTITLE :{BLACK}Wpisz tekst do chat'u +STR_NETWORK_CHAT_OSKTITLE :{BLACK}Wprowadź tekst do czatu sieciowego # Network messages STR_NETWORK_ERROR_NOTAVAILABLE :{WHITE}Nie znaleziono urządzeń sieciowych @@ -2988,7 +3002,7 @@ STR_CONTENT_DETAIL_FILESIZE :{SILVER}Rozmiar STR_CONTENT_DETAIL_SELECTED_BECAUSE_OF :{SILVER}Zaznaczono z powodu: {WHITE}{STRING} STR_CONTENT_DETAIL_DEPENDENCIES :{SILVER}Zależności: {WHITE}{STRING} STR_CONTENT_DETAIL_TAGS :{SILVER}Tagi: {WHITE}{STRING} -STR_CONTENT_NO_ZLIB :{WHITE}OpenTTD jest zbudowany bez wsparcia dla "zlib"... +STR_CONTENT_NO_ZLIB :{WHITE}OpenTTD jest zbudowany bez wsparcia dla „zlib”... STR_CONTENT_NO_ZLIB_SUB :{WHITE}... pobieranie zawartości nie jest możliwe! # Order of these is important! @@ -3114,7 +3128,7 @@ STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP :{BLACK}Wybierz STR_STATION_BUILD_PLATFORM_LENGTH :{BLACK}Długość peronu STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP :{BLACK}Wybierz długość stacji STR_STATION_BUILD_DRAG_DROP :{BLACK}Przeciągnij i upuść -STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}Buduj stację używając "przeciągnij i upuść" +STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}Buduj stację używając „przeciągnij i upuść” STR_STATION_BUILD_STATION_CLASS_TOOLTIP :{BLACK}Wybierz rodzaj stacji do pokazania STR_STATION_BUILD_STATION_TYPE_TOOLTIP :{BLACK}Wybierz typ stacji do zbudowania @@ -3131,13 +3145,13 @@ STR_BUILD_SIGNAL_TOGGLE_ADVANCED_SIGNAL_TOOLTIP :{BLACK}Przełą STR_BUILD_SIGNAL_SEMAPHORE_NORM_TOOLTIP :{BLACK}Sygnalizator bloku (semafor){}Najprostszy typ sygnału pozwalający na przebywanie w jednym bloku wyłącznie jednemu pociągowi naraz STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TOOLTIP :{BLACK}Sygnalizator wejściowy (semafor){}Zielony, póki choć jeden sygnalizator wyjściowy dla kolejnego odcinka trasy jest zielony. W przeciwnym wypadku czerwony. STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TOOLTIP :{BLACK}Sygnalizator wyjściowy (semafor){}Zachowuje się jak sygnalizator blokowy, lecz jest niezbędny do zmiany na poprawny kolor w presygnalizatorach wejściowych i złożonych -STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (semafor){}Sygnalizator złożony zachowuje się jak kombinacja sygnalizatorów wejściowych oraz wyjściowych. Umożliwia to budowę wielkich "drzew" presygnalizatorów +STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (semafor){}Sygnalizator złożony zachowuje się jak kombinacja sygnalizatorów wejściowych oraz wyjściowych. Umożliwia to budowę wielkich „drzew” presygnalizatorów STR_BUILD_SIGNAL_SEMAPHORE_PBS_TOOLTIP :{BLACK}Sygnalizator trasy (semafor){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Zwykłe sygnalizatory trasy mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TOOLTIP :{BLACK}Jednokierunkowy sygnalizator trasy (semafor){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Sygnalizatory jednokierunkowe nie mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_ELECTRIC_NORM_TOOLTIP :{BLACK}Sygnalizator bloku (elektryczny){}Najprostszy typ sygnału pozwalający na przebywanie w jednym bloku wyłącznie jednemu pociągowi naraz STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TOOLTIP :{BLACK}Sygnalizator wejściowy (elektryczny){}Zielony, póki choć jeden sygnalizator wyjściowy dla kolejnego odcinka trasy jest zielony. W przeciwnym przypadku czerwony STR_BUILD_SIGNAL_ELECTRIC_EXIT_TOOLTIP :{BLACK}Sygnalizator wyjściowy (elektryczny){}Zachowuje się jak sygnalizator blokowy, lecz jest niezbędny do zmiany na poprawny kolor w presygnalizatorach wejściowych i złożonych -STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (elektryczny){}Sygnalizator złożony działa jako sygnał wejściowy i wyjściowy. Umożliwia to budowę wielkich "drzew" presygnalizatorów +STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (elektryczny){}Sygnalizator złożony działa jako sygnał wejściowy i wyjściowy. Umożliwia to budowę wielkich „drzew” presygnalizatorów STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP :{BLACK}Sygnalizator trasy (elektryczny){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Zwykłe sygnalizatory trasy mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP :{BLACK}Jednokierunkowy sygnalizator trasy (elektryczny){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Sygnalizatory jednokierunkowe nie mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_CONVERT_TOOLTIP :{BLACK}Zamiana sygnałów{}Jeżeli włączone, kliknięcie na istniejący sygnał spowoduje zamianę go na wybrany typ i wariant. Ctrl+klik przełącza istniejący wariant. Shift+klik pokazuje szacowany koszt zamiany @@ -3766,6 +3780,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Zbadaj o STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} w {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Obiekt STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Typ szyn +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Rodzaj drogi STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGFR zmienna 60+parametr x (heksadecymalnie) @@ -3822,7 +3837,7 @@ STR_NEWGRF_ERROR_GRM_FAILED :Potrzebne źró STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:STRING} został wyłączony przez {STRING} STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Niepoprawny/nieznany format układu sprite'u (sprite {3:NUM}) STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :Zbyt wiele elementów na liście wartości właściwości (sprite {3:NUM}, właściwość {4:HEX}) -STR_NEWGRF_ERROR_INDPROD_CALLBACK :Niewłaściwy wywołanie produkcji przedsiębiorstwa (sprite {3:NUM}, "{2:STRING}") +STR_NEWGRF_ERROR_INDPROD_CALLBACK :Nieprawidłowe wywołanie zwrotne produkcji przedsiębiorstwa (sprite {3:NUM}, „{2:STRING}”) # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Uwaga! @@ -3845,17 +3860,17 @@ STR_NEWGRF_LIST_COMPATIBLE :{YELLOW}Znalezi STR_NEWGRF_LIST_MISSING :{RED}Brakujące pliki # NewGRF 'it's broken' warnings -STR_NEWGRF_BROKEN :{WHITE}Zachowanie NewGRF '{0:STRING}' może powodować desynchronizacje i/lub błędy -STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Zmieniony stan wagonu silnikowego '{1:ENGINE}', gdy był poza halą warsztatów -STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Zmiana długości pojazdu '{1:ENGINE}' , który nie jest zatrzymany w hali -STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Zmieniono ładowność pojazdu na '{1:ENGINE}', kiedy nie był w hali warsztatów lub w trakcie przebudowy +STR_NEWGRF_BROKEN :{WHITE}Zachowanie NewGRF „{0:STRING}” może powodować desynchronizacje i/lub błędy +STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Zmieniony stan wagonu silnikowego „{1:ENGINE}”, gdy był poza halą warsztatów +STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Zmiana długości pojazdu „{1:ENGINE}”, który nie jest zatrzymany w hali warsztatów +STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Zmieniono ładowność pojazdu na „{1:ENGINE}”, kiedy nie był w hali warsztatów lub w trakcie przebudowy STR_BROKEN_VEHICLE_LENGTH :{WHITE}Pociąg „{VEHICLE}” należący do „{COMPANY}” ma nieprawidłową długość. Prawdopodobnie jest to spowodowane problemami z NewGRF-ami. Gra może się desychronizować lub zawiesić -STR_NEWGRF_BUGGY :{WHITE}NewGRF '{0:STRING}' dostarcza niepoprawnych danych -STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Informacje o ładunku/naprawie dla '{1:ENGINE}' różnią się od listy zakupu po zbudowaniu. Może to spowodować, że autoodnowienie/-zamiana nie wykona remontu poprawnie -STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' spowodował nieskończoną pętlę w wywołaniu produkcji -STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Wywołanie {1:HEX} zwróciło nieznany/błędny wynik {2:HEX} -STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' zwrócił niewłaściwy typ ładunku w wywołaniu produkcji w {2:HEX} +STR_NEWGRF_BUGGY :{WHITE}NewGRF „{0:STRING}” dostarcza niepoprawne dane +STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Informacje o ładunku/naprawie dla „{1:ENGINE}” różnią się od listy zakupu po zbudowaniu. Może to spowodować, że autoodnowienie/-zamiana nie wykona remontu poprawnie +STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}„{1:STRING}” spowodował nieskończoną pętlę w wywołaniu zwrotnym produkcji +STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Wywołanie zwrotne {1:HEX} zwróciło nieznany/błędny wynik {2:HEX} +STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}„{1:STRING}” zwrócił niewłaściwy typ ładunku w wywołaniu zwrotnym produkcji w {2:HEX} # 'User removed essential NewGRFs'-placeholders for stuff without specs STR_NEWGRF_INVALID_CARGO : @@ -5023,7 +5038,7 @@ STR_AI_DEBUG_SELECT_AI_TOOLTIP :{BLACK}Pokaż o STR_AI_GAME_SCRIPT :{BLACK}Game Script STR_AI_GAME_SCRIPT_TOOLTIP :{BLACK}Sprawdź log Game Script -STR_ERROR_AI_NO_AI_FOUND :Nie znaleziono SI do wczytania.{}SI jest nieaktywne i nic nie robi.{}Możesz ściągnąć SI z 'Dodatki Online' w głównym menu gry +STR_ERROR_AI_NO_AI_FOUND :Nie znaleziono SI do wczytania.{}SI jest nieaktywne i nic nie robi.{}Możesz pobrać kilka SI z przeglądarki „Dodatków Online” STR_ERROR_AI_PLEASE_REPORT_CRASH :{WHITE}Jeden z uruchomionych skryptów przestał działać. Prosimy o zgłoszenie tego autorowi skryptu dołączając zrzut ekranu okna debugowania SI / GameScript STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}Okno debugowania SI / Game Script jest dostępne tylko na serwerze @@ -5087,6 +5102,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Spis Treści +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Przeskocz do wybranej sekcji w wyświetlanym pliku za pomocą tej listy +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Cofnij się w historii nawigacji +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Powrót do przodu w historii nawigacji STR_TEXTFILE_WRAP_TEXT :{WHITE}Zawijaj tekst STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Zawiń tekst w oknie, aby zmieścił się bez konieczności przewijania STR_TEXTFILE_VIEW_README :{BLACK}Odczytaj plik „readme” @@ -5097,6 +5117,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} {STRING} - lista zmian STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} {STRING} - licencja STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Podgląd wyniku ankiety +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Dokument OpenTTD „{STRING}” # Vehicle loading indicators @@ -5164,8 +5185,8 @@ STR_WARNING_FALLBACK_SOUNDSET :{WHITE}Znalezio STR_WARNING_SCREENSHOT_SIZE_CAPTION :{WHITE}Ogromny zrzut ekranu STR_WARNING_SCREENSHOT_SIZE_MESSAGE :{YELLOW}Zrzut ekranu będzie miał rozdzielczość {COMMA} x {COMMA} pikseli. Zrzut ekranu może zająć chwilę. Kontynuować? -STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY :{WHITE}Mapa wysokości pomyślnie zapisana jako '{STRING}'. Najwyższy szczyt wynosi {NUM} -STR_MESSAGE_SCREENSHOT_SUCCESSFULLY :{WHITE}Zrzut ekranu zapisany na dysk z powodzeniem '{STRING}' +STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY :{WHITE}Mapa wysokości pomyślnie zapisana jako „{STRING}”. Najwyższy szczyt wynosi {NUM} +STR_MESSAGE_SCREENSHOT_SUCCESSFULLY :{WHITE}Zrzut ekranu zapisany na dysk z powodzeniem „{STRING}” STR_ERROR_SCREENSHOT_FAILED :{WHITE}Błąd zrzutu ekranu! # Error message titles diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index ad2bd47b92..9b83d2d549 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecci STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} em {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objecto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo de ferrovia +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo de estrada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parâmetro da variável 60+x do NewGRF (hexadecimal) diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 9c081b4c27..e811e9e610 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -3575,6 +3575,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Прос STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} в {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Объект STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Тип рельсов +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Тип дороги STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Параметр переменной NewGRF 60+x (шестнадцатеричный) From 976f8c474f76147a0c6a2ecbd820719e76e22d83 Mon Sep 17 00:00:00 2001 From: translators Date: Sun, 24 Sep 2023 18:36:59 +0000 Subject: [PATCH 47/59] Update: Translations from eints chinese (simplified): 139 changes by BYXxiaonanhui catalan: 23 changes by J0anJosep portuguese (brazilian): 1 change by pasantoro --- src/lang/brazilian_portuguese.txt | 1 + src/lang/catalan.txt | 23 ++++ src/lang/simplified_chinese.txt | 167 +++++++++++++++++++++++++----- 3 files changed, 163 insertions(+), 28 deletions(-) diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index a4f2c7ca11..7ffca0d45e 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecio STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} em {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objeto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo de ferrovia +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo de estrada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Variável NewGRF 60+ parâmetro x (hexadecimal) diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index 19ea63aa6f..2c0603ee2e 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -524,6 +524,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Esborra tots el # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informació de la casella +STR_ABOUT_MENU_HELP :Ajuda i manuals STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Commuta la consola STR_ABOUT_MENU_AI_DEBUG :Depuració de les IA i l'script de partida @@ -1427,6 +1428,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :Cap* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Reduït STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normal +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :Permet passos a nivell amb carreteres o rails dels competidors: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :Permet la construcció de passos a nivell en carreteres o vies ferroviàries que siguin propietat d'altres jugadors. STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Permet situar parades en carreteres que són propietat de les poblacions: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Permet la construcció de passos a nivell als carrers propietat de les poblacions @@ -2123,6 +2126,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Multijug STR_INTRO_GAME_OPTIONS :{BLACK}Opcions del joc STR_INTRO_HIGHSCORE :{BLACK}Taula de rècords +STR_INTRO_HELP :{BLACK}Ajuda i manuals STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Configuració STR_INTRO_NEWGRF_SETTINGS :{BLACK}Extensions NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Contingut en línia @@ -2144,6 +2148,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Seleccio STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Mostra les opcions del joc STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Mostra la taula de rècords +STR_INTRO_TOOLTIP_HELP :{BLACK}Accediu a la documentació i recursos en línia. STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Mostra la finestra de configuració STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Mostra la configuració de les extensions NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Comprova si hi ha continguts nous i actualitzats per a descarregar @@ -2166,6 +2171,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Esteu s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Esteu segur que voleu sortir de l'escenari? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Ajuda i manuals +STR_HELP_WINDOW_WEBSITES :{BLACK}Llocs web +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Documents +STR_HELP_WINDOW_README :{BLACK}Llegeix-me +STR_HELP_WINDOW_CHANGELOG :{BLACK}Registre de canvis +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Errors coneguts +STR_HELP_WINDOW_LICENSE :{BLACK}Llicència +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manual / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Informeu d'un error +STR_HELP_WINDOW_COMMUNITY :Comunitat # Cheat window STR_CHEATS :{WHITE}Trampes @@ -3385,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecci STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} a {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipus de via +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipus de carretera STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Paràmetre NewGRF variable 60+x (hexadecimal) @@ -4700,6 +4717,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Taula de continguts +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Salteu a una secció del fitxer que es mostra amb aquesta llista. +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Torneu enrere segons l'historial de navegació. +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Aneu avant segons l'historial de navegació. STR_TEXTFILE_WRAP_TEXT :{WHITE}Ajusta text STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ajusta el text afegint-hi canvis de línia, de manera que sigui més fàcil desplaçar-se pel text STR_TEXTFILE_VIEW_README :{BLACK}Veure llegeix-me @@ -4710,6 +4732,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}Llegeix- STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Registre de canvis del {STRING} de {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Llicència del {STRING} de {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Vista prèvia del resultat del sondeig +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Document '{STRING}' de l'OpenTTD # Vehicle loading indicators diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index 01ce55bb28..b4b73809cb 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -191,6 +191,23 @@ STR_COLOUR_WHITE :白 色 STR_COLOUR_RANDOM :随机 ###length 17 +STR_COLOUR_SECONDARY_DARK_BLUE :深蓝色 +STR_COLOUR_SECONDARY_PALE_GREEN :浅绿色 +STR_COLOUR_SECONDARY_SECONDARY_PINK :粉色 +STR_COLOUR_SECONDARY_YELLOW :黄 色 +STR_COLOUR_SECONDARY_RED :红 色 +STR_COLOUR_SECONDARY_LIGHT_BLUE :淡蓝色 +STR_COLOUR_SECONDARY_GREEN :绿 色 +STR_COLOUR_SECONDARY_DARK_GREEN :深绿色 +STR_COLOUR_SECONDARY_BLUE :蓝 色 +STR_COLOUR_SECONDARY_CREAM :奶油色 +STR_COLOUR_SECONDARY_MAUVE :深紫色 +STR_COLOUR_SECONDARY_PURPLE :紫 色 +STR_COLOUR_SECONDARY_ORANGE :橘黄色 +STR_COLOUR_SECONDARY_BROWN :棕 色 +STR_COLOUR_SECONDARY_GREY :浅灰色 +STR_COLOUR_SECONDARY_WHITE :白 色 +STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :与主色调相同 # Units used in OpenTTD @@ -198,6 +215,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{DECIMAL}{NBSP} STR_UNITS_VELOCITY_METRIC :{DECIMAL}{NBSP}千米/小时 STR_UNITS_VELOCITY_SI :{DECIMAL}{NBSP}米/秒 STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}格/天 +STR_UNITS_VELOCITY_KNOTS :{DECIMAL}{NBSP}节 STR_UNITS_POWER_IMPERIAL :{DECIMAL}{NBSP}匹马力 STR_UNITS_POWER_METRIC :{DECIMAL}{NBSP}匹马力 @@ -346,9 +364,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}打开 ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}暂停游戏 STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}快速游戏模式 -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}选项 -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}保存游戏、放弃游戏、退出 -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}显示地图、附加视点或标志列表 +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}选项和设置 +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}保存游戏、读取游戏、放弃游戏、退出 +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}显示地图、附加视点、客货流或标志列表 STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}显示城镇列表 STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}显示财政补贴 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}显示公司所有的车站列表 @@ -356,9 +374,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}显示 STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}显示公司综合信息 STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}显示公司历史纪录 STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}显示游戏目标选单 -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}显示图表 +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}显示图表和货物运费表 STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}显示公司名次表 -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}工业设施列表/产业链/建立新工业设施 +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}查看工业设施或投资工业设施建设 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}显示公司的火车列表。按住 Ctrl 键单击可以切换组群和车辆列表。 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}显示公司的汽车列表。按住 Ctrl 键单击可以切换组群和汽车列表。 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}显示公司的船只列表。按住 Ctrl 键单击可以切换组群和船只列表。 @@ -372,8 +390,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}显示 STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}显示机场建设工具 STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}打开景观美化工具栏{}以修改地形、设置地貌等 STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}显示 声音/音乐 控制菜单 -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}显示最新消息新闻,消息选项,消息历史 -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}地块信息查询,控制台,脚本调试,截图,关于OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}显示最新消息、新闻,消息历史或删除所有消息 +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}查询地块信息、截图、关于 OpenTTD 和开发者工具 STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}切换工具栏 # Extra tooltips for the scenario editor toolbar @@ -505,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :删除全部消 # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :查询地块信息 +STR_ABOUT_MENU_HELP :帮助和指南 STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :切换到控制台模式 STR_ABOUT_MENU_AI_DEBUG :AI /游戏脚本调试 @@ -606,7 +625,7 @@ STR_GRAPH_OPERATING_PROFIT_CAPTION :{WHITE}利润 STR_GRAPH_INCOME_CAPTION :{WHITE}收入图表 STR_GRAPH_CARGO_DELIVERED_CAPTION :{WHITE}运输的货物总数 STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION :{WHITE}公司评价表现指数 (最大指数为1000) -STR_GRAPH_COMPANY_VALUES_CAPTION :{WHITE}公司市值 +STR_GRAPH_COMPANY_VALUES_CAPTION :{WHITE}公司市值图表 STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION :{WHITE}货物运输价格 STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL :{TINY_FONT}{BLACK}运输时间(天) @@ -848,7 +867,7 @@ STR_NEWS_COMPANY_BANKRUPT_TITLE :{BIG_FONT}{BLAC STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION :{BIG_FONT}{BLACK}{STRING} 已经宣布破产,所有资产均已抵债! STR_NEWS_COMPANY_LAUNCH_TITLE :{BIG_FONT}{BLACK}新的运输公司开业大吉! STR_NEWS_COMPANY_LAUNCH_DESCRIPTION :{BIG_FONT}{BLACK}{STRING} 在 {TOWN} 附近开工建设! -STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLACK}{STRING} 被 {STRING} 收购! +STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLACK}{STRING} 被 {STRING} 以未知的价格收购 ! STR_PRESIDENT_NAME_MANAGER :{BLACK}{PRESIDENT_NAME}{}(总裁) STR_NEWS_NEW_TOWN :{BLACK}{BIG_FONT}{STRING} 赞助了城镇 {TOWN} 的建设! @@ -933,12 +952,27 @@ STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT :{BLACK}将主 # Game options window STR_GAME_OPTIONS_CAPTION :{WHITE}游戏选项 +STR_GAME_OPTIONS_TAB_GENERAL :通用 +STR_GAME_OPTIONS_TAB_GENERAL_TT :{BLACK}选择通用设定 +STR_GAME_OPTIONS_TAB_GRAPHICS :图形包 +STR_GAME_OPTIONS_TAB_GRAPHICS_TT :{BLACK}选择图形组设定 +STR_GAME_OPTIONS_TAB_SOUND :音效 +STR_GAME_OPTIONS_TAB_SOUND_TT :{BLACK}选择音乐和音效的设定 +STR_GAME_OPTIONS_VOLUME :音量 +STR_GAME_OPTIONS_SFX_VOLUME :音效 +STR_GAME_OPTIONS_MUSIC_VOLUME :音乐 +STR_GAME_OPTIONS_VOLUME_0 :0% +STR_GAME_OPTIONS_VOLUME_25 :25% +STR_GAME_OPTIONS_VOLUME_50 :50% +STR_GAME_OPTIONS_VOLUME_75 :75% +STR_GAME_OPTIONS_VOLUME_100 :100% STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}货币单位 STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}货币单位选择 +STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING}) ###length 42 STR_GAME_OPTIONS_CURRENCY_GBP :英镑 @@ -990,6 +1024,10 @@ STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}选择 # Autosave dropdown ###length 5 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF :关闭 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_10_MINUTES :每10分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_30_MINUTES :每30分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_60_MINUTES :每60分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_120_MINUTES :每120分钟 STR_GAME_OPTIONS_LANGUAGE :{BLACK}语言 STR_GAME_OPTIONS_LANGUAGE_TOOLTIP :{BLACK}选择界面语言 @@ -1026,6 +1064,13 @@ STR_GAME_OPTIONS_GUI_SCALE_3X :3倍 STR_GAME_OPTIONS_GUI_SCALE_4X :4倍 STR_GAME_OPTIONS_GUI_SCALE_5X :5倍 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME :{BLACK}自动体验调查 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}参与自动体验调查 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_TOOLTIP :{BLACK}“打开”时, OpenTTD会在结束游戏时传输调查结果 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK :{BLACK}关于体验调查和隐私 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK_TOOLTIP :{BLACK}这会提供更多自动体验调查的信息(打开浏览器) +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW :{BLACK}预览调查结果 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW_TOOLTIP :{BLACK}展示正在运行的存档的调查结果 STR_GAME_OPTIONS_GRAPHICS :{BLACK}图像 @@ -1035,12 +1080,12 @@ STR_GAME_OPTIONS_REFRESH_RATE_ITEM :{NUM}Hz STR_GAME_OPTIONS_REFRESH_RATE_WARNING :{WHITE}高于 60Hz 的刷新率可能会影响性能。 STR_GAME_OPTIONS_BASE_GRF :{BLACK}基础图形组 -STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}选择要使用的基础图形组 +STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}选择要使用的基础图形组(只能在主菜单更改,不能在游戏中更改) STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} 文件{}未找到或不正确 STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP :{BLACK}关于基本图组的额外信息 STR_GAME_OPTIONS_BASE_SFX :{BLACK}基础音效组 -STR_GAME_OPTIONS_BASE_SFX_TOOLTIP :{BLACK}选择要使用的基础音效组 +STR_GAME_OPTIONS_BASE_SFX_TOOLTIP :{BLACK}选择要使用的基础音效组(只能在主菜单更改,不能在游戏中更改) STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP :{BLACK}有关基础音效组的附加信息 STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}基础音乐组 @@ -1156,6 +1201,7 @@ STR_CONFIG_SETTING_EXPAND_ALL :{BLACK}展开 STR_CONFIG_SETTING_COLLAPSE_ALL :{BLACK}关闭全部 STR_CONFIG_SETTING_RESET_ALL :{BLACK}重置所有值 STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT :(没有可用的提示) +STR_CONFIG_SETTING_VALUE :{PUSH_COLOUR}{ORANGE}{STRING}{POP_COLOUR} STR_CONFIG_SETTING_DEFAULT_VALUE :{LTBLUE}默认值: {ORANGE}{STRING} STR_CONFIG_SETTING_TYPE :{LTBLUE}设置类型: {ORANGE}{STRING} STR_CONFIG_SETTING_TYPE_CLIENT :当前客户端设置(不保存,影响所有游戏) @@ -1209,6 +1255,7 @@ STR_CONFIG_SETTING_HORIZONTAL_POS_LEFT :左侧 STR_CONFIG_SETTING_HORIZONTAL_POS_CENTER :中央 STR_CONFIG_SETTING_HORIZONTAL_POS_RIGHT :右侧 +STR_CONFIG_SETTING_SECONDS_VALUE :{COMMA}{NBSP}秒 STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN :最大初始贷款: {STRING} STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT :公司最大贷款额(不考虑通货膨胀的影响) @@ -1337,7 +1384,7 @@ STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :新的调度命 STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :通常,车辆在它经过的每一个车站都会停车。“打开”本选项时,车辆会不停车的通过所有中间车站前往最终目的地。注意:这只是为每一条新调度命令设置一个默认信息,仍然可以为每条调度命令设置明确的信息 STR_CONFIG_SETTING_STOP_LOCATION :新列车调度计划中默认命令为停靠在站台{STRING} 位置 -STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :设置车辆在站台的默认停靠位置,“近端”是靠近车辆进入的那一端,“中间”是站台中间位置,“远端”是远离车辆进入的那一端 +STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :设置车辆在站台的默认停靠位置,“近端”是靠近车辆进入的那一端,“中间”是站台中间位置,“远端”是远离车辆进入的那一端。注意:本设定只改变新指令的默认设定。玩家仍可通过点击指令文字改变列车在某车站的停车位置。 ###length 3 STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END :近端 STR_CONFIG_SETTING_STOP_LOCATION_MIDDLE :中间 @@ -1380,6 +1427,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :不出现* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :较少出现 STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :正常 +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :允许在竞争对手所属的道路或铁路上建平交道口: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :“打开”时,允许在竞争对手所属的道路上建平交道口 STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :允许在城镇所属的道路上建通过式车站: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :“打开”时允许在城市所属的道路上建设通过式车站 @@ -1393,6 +1442,8 @@ STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :固定资产会 STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :初创公司颜色:{STRING} STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :选定公司的初始配色方案 +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :公司初始副色调: {STRING} +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :如果正在使用的NewGRF允许,选定一个公司初始副色调。 STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :总允许建设小型机场: {STRING} STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :“打开”此选项,每种类型机场出现后一直是可用的 @@ -1537,7 +1588,7 @@ STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREY_TO_RED :灰色到红色 STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREYSCALE :灰度 STR_CONFIG_SETTING_SCROLLMODE :视点滚动方式:{STRING} -STR_CONFIG_SETTING_SCROLLMODE_HELPTEXT :滚动地图的行为 +STR_CONFIG_SETTING_SCROLLMODE_HELPTEXT :用鼠标拖动地图时的行为。“鼠标位置锁定”选项并不在任何平台上适用,如基于网页的版本、触屏、Linux 上的 Wayland等 ###length 4 STR_CONFIG_SETTING_SCROLLMODE_DEFAULT :鼠标右键移动视角,鼠标指针不跟随移动 STR_CONFIG_SETTING_SCROLLMODE_RMB_LOCKED :鼠标右键移动地图,鼠标指针不跟随移动 @@ -1595,6 +1646,9 @@ STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_OFF :关闭 STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE :右键关闭窗口: {STRING} STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_HELPTEXT :使用在窗口内按右键关闭该窗口,本功能与右键工具提示不能共存! ###length 3 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_NO :否 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES :是 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES_EXCEPT_STICKY :是(非粘滞) STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :使用 {STRING} 形式的文件名存档 STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_HELPTEXT :游戏存档文件名中日期的格式 @@ -1716,7 +1770,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :单个脚本强 STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :保养周期(百分数): {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :选择触发车辆保养的条件,距离上一次保养的时间或者与最高可靠性的百分比 +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :“打开”时,当车辆的可靠性降到他们最大可靠性的一定百分比时,他们会去保养。{}{}例如,如果一辆车的最大可靠性是90%,而保养间隔是20%,车辆会在可靠性为72%时去保养。 STR_CONFIG_SETTING_SERVINT_TRAINS :火车默认保养周期:{STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :如果没有为火车直接指定保养周期,设定默认火车保养周期 @@ -1846,8 +1900,8 @@ STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :“打开”时 STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :允许城镇建设平交道: {STRING} STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :“打开”时允许城镇建设平交路口 -STR_CONFIG_SETTING_NOISE_LEVEL :允许城镇控制机场噪音: {STRING} -STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :“关闭”本选项时,每个城镇可以建设两个机场,“打开”时,可以建设的机场数目取决于城市对噪音的忍耐度,而这与城市人口、机场规模和距离有关 +STR_CONFIG_SETTING_NOISE_LEVEL :基于噪音级别控制机场建设: {STRING} +STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :允许城镇基于城镇人口、机场大小和距离控制机场噪音。“关闭”时,每个城市只允许建设两座机场,除非地方政府态度被设为“宽容的” STR_CONFIG_SETTING_TOWN_FOUNDING :在游戏中建立城镇: {STRING} STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :“打开”本选项时,允许玩家在游戏中创建新城镇 @@ -1921,6 +1975,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :没有 STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :初始城市规模因子:{STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :游戏开局时,城市的平均规模相对于普通城镇的比值 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :每 {STRING} 更新货物分配 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :两次连结图的重新计算间隔。每次重新计算会计算图中一个部分的计划。这意味着填入的值X不意味着整张图会每X秒更新一次,只有其中的一部分会被更新。此设定赋值越小,则更多的CPU时间会被用来重新计算。此设定赋值越大,则在线路改变时货物再分配所需时间会变长。 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :花费 {STRING} 在货物分配的重新计算上 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :每一个连结图的重新计算时间。当一次重新计算开始,一个线程会被允许运行这个秒数。此设定赋值越小,则线程无法按时结束的可能性越大,从而导致游戏运行延迟。此设定赋值越大,则在线路改变时货物再分配所需时间会变长。 STR_CONFIG_SETTING_DISTRIBUTION_PAX :乗客分配方式:{STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :假设有交通路线连接甲、乙两站。“对称”指甲站往乙站的乗客数量与乙站往甲站的乘客数量大致相同。“不对称”指任何一站往另一站的乘客数量皆由系统随意决定。“手动”指系统不会自动分配乘客的目的地。 @@ -1946,13 +2004,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :如果把此设 STR_CONFIG_SETTING_SHORT_PATH_SATURATION :如果最短路径的饱和度超过{STRING},把货物改派往容量较大的路径 STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :货物分配功能在派送货物时,会优先使用最短路径,当它饱和后改用第二短的路径,如此类推。当所有路径皆饱和但仍未满足需求,系统會由容量较大的路径开始继续加载货物。{}由于路径饱和度难以准确估算,此设定容许您定义一值,使短路径达到该饱和度后,系统便开始加载容量较大的路径。{}如果此设定的值少於100%,就算系统高估路径容量,也不會使过多的货物滞留在站台上。 -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位:{STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位(陆地):{STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :速度单位 (航海): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :在界面上以所选择的单位表示速度 ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :英制(英里/小时) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :公制(千米/小时) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :国际单位制(米/秒) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :游戏单位 (格/日) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :节 STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :运输工具功率单位:{STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :在界面上以所选择的单位表示运输工具的功率 @@ -2051,6 +2111,7 @@ STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}无法 # Video initalization errors STR_VIDEO_DRIVER_ERROR :{WHITE}图形设置错误… STR_VIDEO_DRIVER_ERROR_NO_HARDWARE_ACCELERATION :{WHITE}… 找不到合适的 GPU。硬件加速已禁用 +STR_VIDEO_DRIVER_ERROR_HARDWARE_ACCELERATION_CRASH :{WHITE}... GPU使游戏崩溃了。硬件加速已禁用 # Intro window STR_INTRO_CAPTION :{WHITE}OpenTTD {REV} @@ -2064,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}联机 STR_INTRO_GAME_OPTIONS :{BLACK}游戏选项 STR_INTRO_HIGHSCORE :{BLACK}高分榜 +STR_INTRO_HELP :{BLACK}帮助和指南 STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}设置 STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF 设置 STR_INTRO_ONLINE_CONTENT :{BLACK}在线查找扩展包 @@ -2085,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}选择 STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}显示游戏选项 STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}显示高分榜 +STR_INTRO_TOOLTIP_HELP :{BLACK}获取说明和在线资源 STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}显示设置 STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}显示GRF设定 STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}连接服务器并查找扩展包 @@ -2107,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}你确 STR_ABANDON_SCENARIO_QUERY :{YELLOW}你确定要退出当前场景吗? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}帮助和指南 +STR_HELP_WINDOW_WEBSITES :{BLACK}网页 +STR_HELP_WINDOW_DOCUMENTS :{BLACK}文档 +STR_HELP_WINDOW_README :{BLACK}查看说明 +STR_HELP_WINDOW_CHANGELOG :{BLACK}更新日志 +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}已知漏洞 +STR_HELP_WINDOW_LICENSE :{BLACK}许可证 +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}手册 / 百科 +STR_HELP_WINDOW_BUGTRACKER :{BLACK}反馈游戏漏洞 +STR_HELP_WINDOW_COMMUNITY :{BLACK}社区 # Cheat window STR_CHEATS :{WHITE}作弊 @@ -2355,6 +2429,7 @@ STR_NETWORK_CLIENT_LIST_NEW_COMPANY :(新公司) STR_NETWORK_CLIENT_LIST_NEW_COMPANY_TOOLTIP :{BLACK}新建并加入公司 STR_NETWORK_CLIENT_LIST_PLAYER_ICON_SELF_TOOLTIP :{BLACK}这是你 STR_NETWORK_CLIENT_LIST_PLAYER_ICON_HOST_TOOLTIP :{BLACK}这里是游戏的主机 +STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT :{BLACK}{NUM}个客户端 {NUM}/{NUM}所公司 STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT_TOOLTIP :{BLACK}服务器管理员允许的当前连接的玩家数量、公司数量和最多公司数量 # Matches ConnectionType @@ -2382,6 +2457,12 @@ STR_NETWORK_ASK_RELAY_NO :{BLACK}否 STR_NETWORK_ASK_RELAY_YES_ONCE :{BLACK}是,本次请求 STR_NETWORK_ASK_RELAY_YES_ALWAYS :{BLACK}是,不要再次询问 +STR_NETWORK_ASK_SURVEY_CAPTION :是否参与自动调查? +STR_NETWORK_ASK_SURVEY_TEXT :您是否愿意参与自动体验调查?{} OpenTTD 会在结束游戏时传输调查结果。{} 您可以在任意时刻在“游戏选项”菜单修改本选项。 +STR_NETWORK_ASK_SURVEY_PREVIEW :预览调查结果 +STR_NETWORK_ASK_SURVEY_LINK :关于体验调查和隐私 +STR_NETWORK_ASK_SURVEY_NO :否 +STR_NETWORK_ASK_SURVEY_YES :是 STR_NETWORK_SPECTATORS :旁观者 @@ -2588,6 +2669,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}调整 STR_TRANSPARENT_BRIDGES_TOOLTIP :{BLACK}调整桥梁是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_STRUCTURES_TOOLTIP :{BLACK}调整灯塔及信号发射塔是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_CATENARY_TOOLTIP :{BLACK}调整电气铁路电线是否为透明{}CTRL+点击 锁定 +STR_TRANSPARENT_TEXT_TOOLTIP :{BLACK}调整装卸提示和盈亏提示是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_INVISIBLE_TOOLTIP :{BLACK}选择设置为:不显示或透明 # Linkgraph legend window @@ -2671,8 +2753,11 @@ STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}使用 STR_STATION_BUILD_STATION_CLASS_TOOLTIP :{BLACK}选择一个要显示车站类型 STR_STATION_BUILD_STATION_TYPE_TOOLTIP :{BLACK}选择要建造的车站类型 -STR_STATION_CLASS_DFLT :默认车站 +STR_STATION_CLASS_DFLT :默认 +STR_STATION_CLASS_DFLT_STATION :默认车站 +STR_STATION_CLASS_DFLT_ROADSTOP :默认道路站点 STR_STATION_CLASS_WAYP :路标 +STR_STATION_CLASS_WAYP_WAYPOINT :默认路点 # Signal window STR_BUILD_SIGNAL_CAPTION :{WHITE}信号灯 @@ -2896,14 +2981,14 @@ STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_CAPTION :{WHITE}移除 STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_QUERY :{YELLOW}你确定要清除所有工业吗? # Industry cargoes window -STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION :{WHITE}{STRING} 的产业链 -STR_INDUSTRY_CARGOES_CARGO_CAPTION :{WHITE}{STRING} 的产业链 +STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION :{WHITE}产业链- {STRING} +STR_INDUSTRY_CARGOES_CARGO_CAPTION :{WHITE}货物的产业链 - {STRING} STR_INDUSTRY_CARGOES_PRODUCERS :{WHITE}供应商 STR_INDUSTRY_CARGOES_CUSTOMERS :{WHITE}采购商 STR_INDUSTRY_CARGOES_HOUSES :{WHITE}房屋 STR_INDUSTRY_CARGOES_INDUSTRY_TOOLTIP :{BLACK}点击查看上下游产业链 STR_INDUSTRY_CARGOES_CARGO_TOOLTIP :{BLACK}{STRING}{}点该货物可显示其上下游工业 -STR_INDUSTRY_DISPLAY_CHAIN :{BLACK}显示产业链 +STR_INDUSTRY_DISPLAY_CHAIN :{BLACK}产业链 STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP :{BLACK}显示货物的上下游工业 STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP :{BLACK}在缩略地图显示 STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP_TOOLTIP :{BLACK}将该产业链的工业显示在缩略地图中 @@ -3315,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}检查 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :物件 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :铁路类型 +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :道路类型 STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x 参数 (十六进制) @@ -3349,6 +3435,7 @@ STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING STR_NEWGRF_ERROR_MSG_WARNING :{RED}警告:{SILVER}{STRING} STR_NEWGRF_ERROR_MSG_ERROR :{RED}错误:{SILVER}{STRING} STR_NEWGRF_ERROR_MSG_FATAL :{RED}严重错误:{SILVER}{STRING} +STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}NewGRF "{STRING}" 发生了严重错误:{}{STRING} STR_NEWGRF_ERROR_POPUP :{WHITE}NewGRF "{STRING}"发生了一个错误:{}{STRING} STR_NEWGRF_ERROR_VERSION_NUMBER :{1:STRING} 不能与 OpenTTD 报告的 TTDPatch 版本兼容。 STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{1:STRING} 是为 {2:STRING} 版 TTD 开发的。 @@ -3497,8 +3584,8 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_LARGE_ADVERTISING :{PUSH_COLOUR}{Y STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_ROAD_RECONSTRUCTION :{PUSH_COLOUR}{YELLOW}资助市政道路进行重建。{}将造成市内交通阻断 6 个月。{}{POP_COLOUR}费用:{CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_STATUE_OF_COMPANY :{PUSH_COLOUR}{YELLOW}以公司的名义设立一尊塑像。{}为位于该城镇的车站提供永久的评分增益。{}{POP_COLOUR}费用:{CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_NEW_BUILDINGS :{PUSH_COLOUR}{YELLOW}资助市内建设新的商业设施。{}为城镇提供暂时的成长速度增益。{}{POP_COLOUR}费用:{CURRENCY_LONG} -STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT :{PUSH_COLOUR}{YELLOW}购买该市一年的运输专营权。{}其间该市的乘客及货物只允许选用贵公司的运输服务。{}{POP_COLOUR}费用:{CURRENCY_LONG} -STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{PUSH_COLOUR}{YELLOW}贿赂地方政府以提高评价,但有被发现后严厉惩罚的风险。{}{POP_COLOUR}费用:{CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT :{PUSH_COLOUR}{YELLOW}购买该市一年的运输专营权。{}其间该市的乘客及货物只允许选用贵公司的运输服务。若竞争对手对该市的贿赂成功,此合同将被取消。{}{POP_COLOUR}费用:{CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{PUSH_COLOUR}{YELLOW}贿赂地方政府以提高评价,并终止竞争者的运输专营权,但有被发现后严厉惩罚的风险。{}{POP_COLOUR}费用:{CURRENCY_LONG} # Goal window STR_GOALS_CAPTION :{WHITE}{COMPANY} 目标 @@ -3720,6 +3807,8 @@ STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}固定 STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}显示详细的设施情况 STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}给予资金 STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}给予该公司资金 +STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON :{BLACK}不受其欢迎的收购 +STR_COMPANY_VIEW_HOSTILE_TAKEOVER_TOOLTIP :{BLACK}对此公司进行不受其欢迎的收购 STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}新的头像 STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}为总裁选择新头像 @@ -3735,6 +3824,7 @@ STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :总裁姓名 STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :输入你要给予的金额 STR_BUY_COMPANY_MESSAGE :{WHITE}我们正在寻找一家愿意收购我们的公司。{}{}您愿意收购 {COMPANY} ({CURRENCY_LONG}) 吗? +STR_BUY_COMPANY_HOSTILE_TAKEOVER :{WHITE}当不受其欢迎地收购 {COMPANY} 时,您会买下其所有的资产,还清其所有的债务,并支付其两年的利润。{}{}总价预计为 {CURRENCY_LONG}.{}{}您想继续此收购吗? # Company infrastructure window STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION :{WHITE}{COMPANY} 的设施 @@ -3806,7 +3896,10 @@ STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}管理 STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP :{BLACK}向所有在此列表中的运输工具发出指令 STR_VEHICLE_LIST_REPLACE_VEHICLES :替换车辆/飞机/船只 STR_VEHICLE_LIST_SEND_FOR_SERVICING :进行保养 +STR_VEHICLE_LIST_CREATE_GROUP :创建分组 STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR :{TINY_FONT}{BLACK}今年利润:{CURRENCY_LONG} (去年利润:{CURRENCY_LONG}) +STR_VEHICLE_LIST_CARGO :[{CARGO_LIST}] +STR_VEHICLE_LIST_NAME_AND_CARGO :{STRING} {STRING} STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT :前往列车车库 STR_VEHICLE_LIST_SEND_ROAD_VEHICLE_TO_DEPOT :前往汽车车库 @@ -4517,7 +4610,7 @@ STR_TIMETABLE_CLEAR_SPEED :{BLACK}取消 STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}清除高亮调度命令的最高限速。按住 Ctrl 键单击可以清除所有命令的最高限速 STR_TIMETABLE_RESET_LATENESS :{BLACK}清除晚点计数器 -STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}重置晚点计数器,从而使车辆准时到达 +STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}重置晚点计数器,从而使车辆被视为准时到达。CTRL+点击会重置全分组的计数器,从而使晚点最多的载具被视为准点而其他被视为早点 STR_TIMETABLE_AUTOFILL :{BLACK}自动填充 STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}根据下一次运行的时间自动填充时间表。按住Ctrl单击可保持等候时间 @@ -4526,6 +4619,8 @@ STR_TIMETABLE_EXPECTED :{BLACK}预期 STR_TIMETABLE_SCHEDULED :{BLACK}表定时间 STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}切换显示(根据实际情况计算的)预期时间或表定时间 +STR_TIMETABLE_ARRIVAL :A: {COLOUR}{DATE_TINY} +STR_TIMETABLE_DEPARTURE :D: {COLOUR}{DATE_TINY} # Date window (for timetable) @@ -4562,14 +4657,16 @@ STR_ERROR_AI_PLEASE_REPORT_CRASH :{WHITE}您使 STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}AI调试窗口只对服务器可用 # AI configuration window -STR_AI_CONFIG_CAPTION_AI :{WHITE}AI配置 -STR_AI_CONFIG_CAPTION_GAMESCRIPT :{WHITE}游戏脚本配置 +STR_AI_CONFIG_CAPTION_AI :{WHITE}AI 设置 +STR_AI_CONFIG_CAPTION_GAMESCRIPT :{WHITE}游戏脚本设定 STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}下局游戏将启用这些脚本 STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}下局游戏将启用这些AI STR_AI_CONFIG_HUMAN_PLAYER :玩家 STR_AI_CONFIG_RANDOM_AI :随机 AI STR_AI_CONFIG_NONE :(无) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}最大竞争对手个数:{ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}竞争对手公司建立间隔: {ORANGE}{COMMA} 分钟 STR_AI_CONFIG_MOVE_UP :{BLACK}上移 STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}在列表中将选择的AI上移 @@ -4582,7 +4679,7 @@ STR_AI_CONFIG_AI :{SILVER}AI STR_AI_CONFIG_CHANGE_AI :{BLACK}选择 AI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}选择游戏脚本 -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}装在另一脚本 +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}载入另一脚本。CTRL+点击以显示所有可用版本 STR_AI_CONFIG_CONFIGURE :{BLACK}设定 STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}设定脚本参数 @@ -4619,6 +4716,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}目录 +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}通过此列表快速访问想要查看的页面 +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}退回到定位历史 +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}取消定位历史撤回 STR_TEXTFILE_WRAP_TEXT :{WHITE}強迫文字换行 STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}強迫宽于窗格的內文自动换行 STR_TEXTFILE_VIEW_README :{BLACK}查看说明 @@ -4628,6 +4730,8 @@ STR_TEXTFILE_VIEW_LICENCE :{BLACK}版权 STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} {STRING} 的说明 STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} {STRING} 的更新日志 STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} {STRING} 的版权信息 +STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}预览调查结果 +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD 文档 '{STRING}' # Vehicle loading indicators @@ -4810,7 +4914,7 @@ STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}汽车 STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}距离另一码头过近 STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}距离另一机场过近 STR_ERROR_CAN_T_RENAME_STATION :{WHITE}不能重命名车站 -STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD :{WHITE}这是一条城镇所属的道路 +STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD :{WHITE}... 城镇所有的道路 STR_ERROR_DRIVE_THROUGH_DIRECTION :{WHITE}道路方向不对 STR_ERROR_DRIVE_THROUGH_CORNER :{WHITE}... 途中型车站不能建在转角处 STR_ERROR_DRIVE_THROUGH_JUNCTION :{WHITE}... 不能在岔路口修建过路型站台 @@ -5069,6 +5173,7 @@ STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... 飞 # Extra messages which go on the third line of errors, explaining why orders failed STR_ERROR_NO_RAIL_STATION :{WHITE}没有火车站 STR_ERROR_NO_BUS_STATION :{WHITE}没有公交车站 +STR_ERROR_NO_TRUCK_STATION :{WHITE}没有货车站 STR_ERROR_NO_DOCK :{WHITE}这里没有码头 STR_ERROR_NO_AIRPORT :{WHITE}没有机场/直升机场 STR_ERROR_NO_STOP_COMPATIBLE_ROAD_TYPE :{WHITE}没有兼容此道路类型的站点 @@ -5077,11 +5182,13 @@ STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :{WHITE}没有 STR_ERROR_AIRPORT_NO_PLANES :{WHITE}这架飞机不能降落在这个直升机场 STR_ERROR_AIRPORT_NO_HELICOPTERS :{WHITE}这架直升机不能降落在这个机场 STR_ERROR_NO_RAIL_WAYPOINT :{WHITE}没有铁路路点 +STR_ERROR_NO_BUOY :{WHITE}没有浮标 # Timetable related errors STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}不能给车辆编制时间表… STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}车辆只能在站内等候。 STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}此车辆将不停靠本站。 +STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... 时间表不完整 # Sign related errors STR_ERROR_TOO_MANY_SIGNS :{WHITE}……标志太多了 @@ -5561,17 +5668,21 @@ STR_VEHICLE_NAME :{VEHICLE} STR_WAYPOINT_NAME :{WAYPOINT} STR_JUST_CARGO :{CARGO_LONG} +STR_JUST_RIGHT_ARROW :{RIGHT_ARROW} STR_JUST_CHECKMARK :{CHECKMARK} STR_JUST_COMMA :{COMMA} STR_JUST_CURRENCY_SHORT :{CURRENCY_SHORT} STR_JUST_CURRENCY_LONG :{CURRENCY_LONG} STR_JUST_CARGO_LIST :{CARGO_LIST} +STR_JUST_DECIMAL :{DECIMAL} STR_JUST_INT :{NUM} STR_JUST_DATE_TINY :{DATE_TINY} STR_JUST_DATE_SHORT :{DATE_SHORT} STR_JUST_DATE_LONG :{DATE_LONG} STR_JUST_DATE_ISO :{DATE_ISO} STR_JUST_STRING :{STRING} +STR_JUST_STRING1 :{STRING} +STR_JUST_STRING2 :{STRING} STR_JUST_STRING_STRING :{STRING}{STRING} STR_JUST_RAW_STRING :{STRING} STR_JUST_BIG_RAW_STRING :{BIG_FONT}{STRING} From a6501942276b53aa30f43638f38eecab5da728ff Mon Sep 17 00:00:00 2001 From: translators Date: Mon, 25 Sep 2023 18:38:49 +0000 Subject: [PATCH 48/59] Update: Translations from eints finnish: 1 change by hpiirai --- src/lang/finnish.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index aad0be1065..548742eae0 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Tutki va STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} sijainnissa {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objekti STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rautatien tyyppi +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tien tyyppi STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF muuttujan 60+x parametri (heksadesimaali) From a454773a73f9f4edf1b28afcb40e915931e4ecb0 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 25 Sep 2023 22:11:20 +0200 Subject: [PATCH 49/59] Doc: Link 3rdparty licenses from README. (#11333) --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d2b6f3f7f5..6c40d04d0c 100644 --- a/README.md +++ b/README.md @@ -185,6 +185,12 @@ See the comments in the source files in `src/3rdparty/md5` for the complete lice The fmt implementation in `src/3rdparty/fmt` is licensed under the MIT license. See `src/3rdparty/fmt/LICENSE.rst` for the complete license text. +The nlohmann json implementation in `src/3rdparty/nlohmann` is licensed under the MIT license. +See `src/3rdparty/nlohmann/LICENSE.MIT` for the complete license text. + +The OpenGL API in `src/3rdparty/opengl` is licensed under the MIT license. +See `src/3rdparty/opengl/khrplatform.h` for the complete license text. + The catch2 implementation in `src/3rdparty/catch2` is licensed under the Boost Software License, Version 1.0. See `src/3rdparty/catch2/LICENSE.txt` for the complete license text. From 49dae08a3bd09630bdb7fe44e5a868f0eb837e77 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Thu, 13 Apr 2023 07:23:18 +0100 Subject: [PATCH 50/59] Codechange: Add missing override specifiers. --- src/aircraft.h | 34 +++++++++++++-------------- src/bitmap_type.h | 4 ++-- src/console_cmds.cpp | 6 ++--- src/core/pool_type.hpp | 2 +- src/disaster_vehicle.h | 4 ++-- src/effectvehicle_base.h | 4 ++-- src/game/game_text.cpp | 12 +++++----- src/ini_type.h | 4 ++-- src/linkgraph/demands.h | 2 +- src/linkgraph/flowmapper.h | 2 +- src/linkgraph/init.h | 2 +- src/linkgraph/mcf.h | 2 +- src/network/network_server.h | 2 +- src/newgrf_airport.h | 4 ++-- src/newgrf_commons.h | 6 ++--- src/newgrf_roadtype.h | 4 ++-- src/newgrf_spritegroup.h | 12 +++++----- src/newgrf_storage.h | 2 +- src/newgrf_town.h | 4 ++-- src/openttd.cpp | 2 +- src/saveload/station_sl.cpp | 12 +++++----- src/script/api/script_asyncmode.hpp | 2 +- src/script/api/script_execmode.hpp | 2 +- src/script/api/script_list.cpp | 32 ++++++++++++------------- src/script/api/script_testmode.hpp | 2 +- src/script/api/script_text.hpp | 2 +- src/settings_gui.cpp | 36 ++++++++++++++--------------- src/settingsgen/settingsgen.cpp | 4 ++-- src/sound/allegro_s.h | 10 ++++---- src/spriteloader/grf.hpp | 2 +- src/station_base.h | 4 ++-- src/strgen/strgen.cpp | 10 ++++---- src/string.cpp | 8 +++---- src/tilearea_type.h | 8 +++---- 34 files changed, 124 insertions(+), 124 deletions(-) diff --git a/src/aircraft.h b/src/aircraft.h index 815542587a..a11383332c 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -89,28 +89,28 @@ struct Aircraft FINAL : public SpecializedVehicle { /** We want to 'destruct' the right class. */ virtual ~Aircraft() { this->PreDestructor(); } - void MarkDirty(); - void UpdateDeltaXY(); - ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; } - bool IsPrimaryVehicle() const { return this->IsNormalAircraft(); } - void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; - int GetDisplaySpeed() const { return this->cur_speed; } - int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; } - int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; } - int GetCurrentMaxSpeed() const { return this->GetSpeedOldUnits(); } - Money GetRunningCost() const; - - bool IsInDepot() const + void MarkDirty() override; + void UpdateDeltaXY() override; + ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; } + bool IsPrimaryVehicle() const override { return this->IsNormalAircraft(); } + void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override; + int GetDisplaySpeed() const override { return this->cur_speed; } + int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; } + int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; } + int GetCurrentMaxSpeed() const override { return this->GetSpeedOldUnits(); } + Money GetRunningCost() const override; + + bool IsInDepot() const override { assert(this->IsPrimaryVehicle()); return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); } - bool Tick(); - void OnNewDay(); - uint Crash(bool flooded = false); - TileIndex GetOrderStationLocation(StationID station); - ClosestDepot FindClosestDepot(); + bool Tick() override; + void OnNewDay() override; + uint Crash(bool flooded = false) override; + TileIndex GetOrderStationLocation(StationID station) override; + ClosestDepot FindClosestDepot() override; /** * Check if the aircraft type is a normal flying device; eg diff --git a/src/bitmap_type.h b/src/bitmap_type.h index 3ff0297910..4dd356e48a 100644 --- a/src/bitmap_type.h +++ b/src/bitmap_type.h @@ -116,7 +116,7 @@ public: if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this); } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { (*this).OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) { @@ -125,7 +125,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index eaf2609014..2a51df0c6c 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1862,17 +1862,17 @@ static ContentType StringToContentType(const char *str) /** Asynchronous callback */ struct ConsoleContentCallback : public ContentCallback { - void OnConnect(bool success) + void OnConnect(bool success) override { IConsolePrint(CC_DEFAULT, "Content server connection {}.", success ? "established" : "failed"); } - void OnDisconnect() + void OnDisconnect() override { IConsolePrint(CC_DEFAULT, "Content server connection closed."); } - void OnDownloadComplete(ContentID cid) + void OnDownloadComplete(ContentID cid) override { IConsolePrint(CC_DEFAULT, "Completed download of {}.", cid); } diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp index 11190bdc00..32eb364f2c 100644 --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -97,7 +97,7 @@ struct Pool : PoolBase { Titem **data; ///< Pointer to array of pointers to Titem Pool(const char *name); - virtual void CleanPool(); + void CleanPool() override; /** * Returns Titem with given index diff --git a/src/disaster_vehicle.h b/src/disaster_vehicle.h index c10bedb7d5..196f4ade95 100644 --- a/src/disaster_vehicle.h +++ b/src/disaster_vehicle.h @@ -47,9 +47,9 @@ struct DisasterVehicle FINAL : public SpecializedVehiclestrings.emplace_back((const char *)buffer, length); } @@ -154,12 +154,12 @@ struct StringNameWriter : HeaderWriter { { } - void WriteStringID(const std::string &name, int stringid) + void WriteStringID(const std::string &name, int stringid) override { if (stringid == (int)this->strings.size()) this->strings.emplace_back(name); } - void Finalise(const StringData &) + void Finalise(const StringData &) override { /* Nothing to do. */ } diff --git a/src/ini_type.h b/src/ini_type.h index 0981cbd197..192ac8598e 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -90,8 +90,8 @@ struct IniFile : IniLoadFile { bool SaveToDisk(const std::string &filename); - virtual FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size); - virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post); + FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size) override; + void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override; }; #endif /* INI_TYPE_H */ diff --git a/src/linkgraph/demands.h b/src/linkgraph/demands.h index a81079528a..7de853a674 100644 --- a/src/linkgraph/demands.h +++ b/src/linkgraph/demands.h @@ -32,7 +32,7 @@ public: * Call the demand calculator on the given component. * @param job Component to calculate the demands for. */ - virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); } + void Run(LinkGraphJob &job) const override { DemandCalculator c(job); } /** * Virtual destructor has to be defined because of virtual Run(). diff --git a/src/linkgraph/flowmapper.h b/src/linkgraph/flowmapper.h index da7375b8a6..c59aa3f527 100644 --- a/src/linkgraph/flowmapper.h +++ b/src/linkgraph/flowmapper.h @@ -28,7 +28,7 @@ public: * values. Only do that on the very last flow mapping. */ FlowMapper(bool scale) : scale(scale) {} - virtual void Run(LinkGraphJob &job) const; + void Run(LinkGraphJob &job) const override; private: diff --git a/src/linkgraph/init.h b/src/linkgraph/init.h index a627005162..a913613da3 100644 --- a/src/linkgraph/init.h +++ b/src/linkgraph/init.h @@ -16,7 +16,7 @@ public: * Initialize the link graph job. * @param job Job to be initialized. */ - virtual void Run(LinkGraphJob &job) const { job.Init(); } + void Run(LinkGraphJob &job) const override { job.Init(); } }; #endif /* INIT_H */ diff --git a/src/linkgraph/mcf.h b/src/linkgraph/mcf.h index a3981877ff..990e9650ed 100644 --- a/src/linkgraph/mcf.h +++ b/src/linkgraph/mcf.h @@ -80,7 +80,7 @@ public: * Run the calculation. * @param graph Component to be calculated. */ - virtual void Run(LinkGraphJob &job) const { Tpass pass(job); } + void Run(LinkGraphJob &job) const override { Tpass pass(job); } }; #endif /* MCF_H */ diff --git a/src/network/network_server.h b/src/network/network_server.h index 96a2e52475..fa3608e974 100644 --- a/src/network/network_server.h +++ b/src/network/network_server.h @@ -75,7 +75,7 @@ public: ServerNetworkGameSocketHandler(SOCKET s); ~ServerNetworkGameSocketHandler(); - virtual Packet *ReceivePacket() override; + Packet *ReceivePacket() override; NetworkRecvStatus CloseConnection(NetworkRecvStatus status) override; std::string GetClientName() const; diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index eafcef04ac..a07dd504b5 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -43,7 +43,7 @@ public: { } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { this->att++; if (this->att->ti.x == -0x80) { @@ -60,7 +60,7 @@ public: return this->att->gfx; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index a52ebf78a9..76b7191513 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -246,7 +246,7 @@ public: struct IndustryTileSpec; class IndustryTileOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16_t testid) { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: IndustryTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} @@ -266,7 +266,7 @@ public: struct AirportTileSpec; class AirportTileOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: AirportTileOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} @@ -277,7 +277,7 @@ public: struct ObjectSpec; class ObjectOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: ObjectOverrideManager(uint16_t offset, uint16_t maximum, uint16_t invalid) : OverrideManagerBase(offset, maximum, invalid) {} diff --git a/src/newgrf_roadtype.h b/src/newgrf_roadtype.h index fb9194f623..43c9c9cf7a 100644 --- a/src/newgrf_roadtype.h +++ b/src/newgrf_roadtype.h @@ -32,8 +32,8 @@ struct RoadTypeScopeResolver : public ScopeResolver { { } - /* virtual */ uint32_t GetRandomBits() const; - /* virtual */ uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; + uint32_t GetRandomBits() const override; + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; }; /** Resolver object for road types. */ diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index c01f64f817..e1ce8ffc19 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -90,7 +90,7 @@ struct RealSpriteGroup : SpriteGroup { std::vector loading; ///< List of loading groups (can be SpriteIDs or Callback results) protected: - const SpriteGroup *Resolve(ResolverObject &object) const; + const SpriteGroup *Resolve(ResolverObject &object) const override; }; /* Shared by deterministic and random groups. */ @@ -179,7 +179,7 @@ struct DeterministicSpriteGroup : SpriteGroup { const SpriteGroup *error_group; // was first range, before sorting ranges protected: - const SpriteGroup *Resolve(ResolverObject &object) const; + const SpriteGroup *Resolve(ResolverObject &object) const override; }; enum RandomizedSpriteGroupCompareMode { @@ -201,7 +201,7 @@ struct RandomizedSpriteGroup : SpriteGroup { std::vector groups; ///< Take the group with appropriate index: protected: - const SpriteGroup *Resolve(ResolverObject &object) const; + const SpriteGroup *Resolve(ResolverObject &object) const override; }; @@ -227,7 +227,7 @@ struct CallbackResultSpriteGroup : SpriteGroup { } uint16_t result; - uint16_t GetCallbackResult() const { return this->result; } + uint16_t GetCallbackResult() const override { return this->result; } }; @@ -249,8 +249,8 @@ struct ResultSpriteGroup : SpriteGroup { SpriteID sprite; byte num_sprites; - SpriteID GetResult() const { return this->sprite; } - byte GetNumResults() const { return this->num_sprites; } + SpriteID GetResult() const override { return this->sprite; } + byte GetNumResults() const override { return this->num_sprites; } }; /** diff --git a/src/newgrf_storage.h b/src/newgrf_storage.h index 95ad50cec4..16c5b8c700 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -113,7 +113,7 @@ struct PersistentStorageArray : BasePersistentStorageArray { return this->storage[pos]; } - void ClearChanges() + void ClearChanges() override { if (this->prev_storage) { this->storage = *this->prev_storage; diff --git a/src/newgrf_town.h b/src/newgrf_town.h index f63f2794b1..88f3d5095d 100644 --- a/src/newgrf_town.h +++ b/src/newgrf_town.h @@ -34,8 +34,8 @@ struct TownScopeResolver : public ScopeResolver { { } - virtual uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const; - virtual void StorePSA(uint reg, int32_t value); + uint32_t GetVariable(byte variable, [[maybe_unused]] uint32_t parameter, bool *available) const override; + void StorePSA(uint reg, int32_t value) override; }; /** Resolver of town properties. */ diff --git a/src/openttd.cpp b/src/openttd.cpp index 418f49abac..7c281a5eb2 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -399,7 +399,7 @@ struct AfterNewGRFScan : NewGRFScanCallback { static_assert(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed)); } - virtual void OnNewGRFsScanned() + void OnNewGRFsScanned() override { ResetGRFConfig(false); diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp index f3b7af25a3..8544b65428 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -665,19 +665,19 @@ public: }; inline const static SaveLoadCompatTable compat_description = _station_normal_sl_compat; - void Save(BaseStation *bst) const + void Save(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetDescription()); } - void Load(BaseStation *bst) const + void Load(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetLoadDescription()); } - void FixPointers(BaseStation *bst) const + void FixPointers(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetDescription()); @@ -696,19 +696,19 @@ public: }; inline const static SaveLoadCompatTable compat_description = _station_waypoint_sl_compat; - void Save(BaseStation *bst) const + void Save(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetDescription()); } - void Load(BaseStation *bst) const + void Load(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetLoadDescription()); } - void FixPointers(BaseStation *bst) const + void FixPointers(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetDescription()); diff --git a/src/script/api/script_asyncmode.hpp b/src/script/api/script_asyncmode.hpp index ba8014b86d..788508ee8d 100644 --- a/src/script/api/script_asyncmode.hpp +++ b/src/script/api/script_asyncmode.hpp @@ -57,7 +57,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_ASYNCMODE_HPP */ diff --git a/src/script/api/script_execmode.hpp b/src/script/api/script_execmode.hpp index f7ea55a1f6..a673a195b2 100644 --- a/src/script/api/script_execmode.hpp +++ b/src/script/api/script_execmode.hpp @@ -48,7 +48,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_EXECMODE_HPP */ diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp index 9df94a4821..8a9339e020 100644 --- a/src/script/api/script_list.cpp +++ b/src/script/api/script_list.cpp @@ -90,7 +90,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->buckets.empty()) return 0; this->has_no_more_items = false; @@ -105,7 +105,7 @@ public: return item_current; } - void End() + void End() override { this->bucket_list = nullptr; this->has_no_more_items = true; @@ -135,7 +135,7 @@ public: this->item_next = *this->bucket_list_iter; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -144,7 +144,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -179,7 +179,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->buckets.empty()) return 0; this->has_no_more_items = false; @@ -199,7 +199,7 @@ public: return item_current; } - void End() + void End() override { this->bucket_list = nullptr; this->has_no_more_items = true; @@ -232,7 +232,7 @@ public: this->item_next = *this->bucket_list_iter; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -241,7 +241,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -271,7 +271,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->items.empty()) return 0; this->has_no_more_items = false; @@ -284,7 +284,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; } @@ -302,7 +302,7 @@ public: if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -311,7 +311,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -344,7 +344,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->items.empty()) return 0; this->has_no_more_items = false; @@ -358,7 +358,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; } @@ -381,7 +381,7 @@ public: if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -390,7 +390,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; diff --git a/src/script/api/script_testmode.hpp b/src/script/api/script_testmode.hpp index 956a25e2d6..abebc0a6ce 100644 --- a/src/script/api/script_testmode.hpp +++ b/src/script/api/script_testmode.hpp @@ -50,7 +50,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_TESTMODE_HPP */ diff --git a/src/script/api/script_text.hpp b/src/script/api/script_text.hpp index 7509065fde..8e6f108ce3 100644 --- a/src/script/api/script_text.hpp +++ b/src/script/api/script_text.hpp @@ -125,7 +125,7 @@ public: /** * @api -all */ - virtual std::string GetEncodedText(); + std::string GetEncodedText() override; private: using ScriptTextRef = ScriptObjectRef; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index fd81ce74a1..176203b4ff 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1016,11 +1016,11 @@ struct SettingEntry : BaseSettingEntry { SettingEntry(const char *name); - virtual void Init(byte level = 0); - virtual void ResetAll(); - virtual uint Length() const; - virtual uint GetMaxHelpHeight(int maxw); - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + void Init(byte level = 0) override; + void ResetAll() override; + uint Length() const override; + uint GetMaxHelpHeight(int maxw) override; + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; void SetButtons(byte new_val); @@ -1036,7 +1036,7 @@ struct SettingEntry : BaseSettingEntry { void SetValueDParams(uint first_param, int32_t value) const; protected: - virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; + void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override; private: bool IsVisibleByRestrictionMode(RestrictionMode mode) const; @@ -1077,23 +1077,23 @@ struct SettingsPage : BaseSettingEntry, SettingsContainer { SettingsPage(StringID title); - virtual void Init(byte level = 0); - virtual void ResetAll(); - virtual void FoldAll(); - virtual void UnFoldAll(); + void Init(byte level = 0) override; + void ResetAll() override; + void FoldAll() override; + void UnFoldAll() override; - virtual uint Length() const; - virtual void GetFoldingState(bool &all_folded, bool &all_unfolded) const; - virtual bool IsVisible(const BaseSettingEntry *item) const; - virtual BaseSettingEntry *FindEntry(uint row, uint *cur_row); - virtual uint GetMaxHelpHeight(int maxw) { return SettingsContainer::GetMaxHelpHeight(maxw); } + uint Length() const override; + void GetFoldingState(bool &all_folded, bool &all_unfolded) const override; + bool IsVisible(const BaseSettingEntry *item) const override; + BaseSettingEntry *FindEntry(uint row, uint *cur_row) override; + uint GetMaxHelpHeight(int maxw) override { return SettingsContainer::GetMaxHelpHeight(maxw); } - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; - virtual uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const; + uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const override; protected: - virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; + void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override; }; /* == BaseSettingEntry methods == */ diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index cf1a2bb4e6..246e06201a 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -159,7 +159,7 @@ struct SettingsIniFile : IniLoadFile { { } - virtual FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) + FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) override { /* Open the text file in binary mode to prevent end-of-line translations * done by ftell() and friends, as defined by K&R. */ @@ -173,7 +173,7 @@ struct SettingsIniFile : IniLoadFile { return in; } - virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post) + void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override { FatalError("{}{}{}", pre, buffer, post); } diff --git a/src/sound/allegro_s.h b/src/sound/allegro_s.h index de609f647f..d2ef08366c 100644 --- a/src/sound/allegro_s.h +++ b/src/sound/allegro_s.h @@ -15,19 +15,19 @@ /** Implementation of the allegro sound driver. */ class SoundDriver_Allegro : public SoundDriver { public: - const char *Start(const StringList ¶m); + const char *Start(const StringList ¶m) override; - void Stop(); + void Stop() override; - void MainLoop(); - const char *GetName() const { return "allegro"; } + void MainLoop() override; + const char *GetName() const override { return "allegro"; } }; /** Factory for the allegro sound driver. */ class FSoundDriver_Allegro : public DriverFactoryBase { public: FSoundDriver_Allegro() : DriverFactoryBase(Driver::DT_SOUND, 4, "allegro", "Allegro Sound Driver (param hz,samples)") {} - /* virtual */ Driver *CreateInstance() const { return new SoundDriver_Allegro(); } + Driver *CreateInstance() const override { return new SoundDriver_Allegro(); } }; #endif /* SOUND_ALLEGRO_H */ diff --git a/src/spriteloader/grf.hpp b/src/spriteloader/grf.hpp index d7d5d66d4e..e9ec85726a 100644 --- a/src/spriteloader/grf.hpp +++ b/src/spriteloader/grf.hpp @@ -17,7 +17,7 @@ class SpriteLoaderGrf : public SpriteLoader { byte container_ver; public: SpriteLoaderGrf(byte container_ver) : container_ver(container_ver) {} - uint8_t LoadSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags); + uint8_t LoadSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t file_pos, SpriteType sprite_type, bool load_32bpp, byte control_flags) override; }; #endif /* SPRITELOADER_GRF_HPP */ diff --git a/src/station_base.h b/src/station_base.h index 8596b38365..2426694b39 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -538,7 +538,7 @@ public: if (!st->TileBelongsToAirport(this->tile)) ++(*this); } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { (*this).OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) { @@ -547,7 +547,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 3f9334c62a..ce8f98517f 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -238,7 +238,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { this->output_stream << "#define TABLE_STRINGS_H\n"; } - void WriteStringID(const std::string &name, int stringid) + void WriteStringID(const std::string &name, int stringid) override { if (prev + 1 != stringid) this->output_stream << "\n"; fmt::print(this->output_stream, "static const StringID {} = 0x{:X};\n", name, stringid); @@ -246,7 +246,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { total_strings++; } - void Finalise(const StringData &data) + void Finalise(const StringData &data) override { /* Find the plural form with the most amount of cases. */ int max_plural_forms = 0; @@ -293,18 +293,18 @@ struct LanguageFileWriter : LanguageWriter, FileWriter { { } - void WriteHeader(const LanguagePackHeader *header) + void WriteHeader(const LanguagePackHeader *header) override { this->Write((const byte *)header, sizeof(*header)); } - void Finalise() + void Finalise() override { this->output_stream.put(0); this->FileWriter::Finalise(); } - void Write(const byte *buffer, size_t length) + void Write(const byte *buffer, size_t length) override { this->output_stream.write((const char *)buffer, length); } diff --git a/src/string.cpp b/src/string.cpp index 7fc604e7ca..badbe6bf63 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -812,14 +812,14 @@ public: { } - virtual void SetString(const char *s) + void SetString(const char *s) override { this->string = s; this->len = strlen(s); this->cur_pos = 0; } - virtual size_t SetCurPosition(size_t pos) + size_t SetCurPosition(size_t pos) override { assert(this->string != nullptr && pos <= this->len); /* Sanitize in case we get a position inside an UTF-8 sequence. */ @@ -827,7 +827,7 @@ public: return this->cur_pos = pos; } - virtual size_t Next(IterType what) + size_t Next(IterType what) override { assert(this->string != nullptr); @@ -865,7 +865,7 @@ public: return END; } - virtual size_t Prev(IterType what) + size_t Prev(IterType what) override { assert(this->string != nullptr); diff --git a/src/tilearea_type.h b/src/tilearea_type.h index 69304bcb09..04c1e1a1d6 100644 --- a/src/tilearea_type.h +++ b/src/tilearea_type.h @@ -210,7 +210,7 @@ public: /** * Move ourselves to the next tile in the rectangle on the map. */ - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { assert(this->tile != INVALID_TILE); @@ -225,7 +225,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } @@ -262,9 +262,9 @@ public: *this = DiagonalTileIterator(DiagonalTileArea(corner1, corner2)); } - TileIterator& operator ++(); + TileIterator& operator ++() override; - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } From 015fbafe34bfb8d626e4c3d577686c149e2892eb Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 25 Sep 2023 13:02:51 +0100 Subject: [PATCH 51/59] Codechange: Add missing override specifiers to squirrel. --- src/3rdparty/squirrel/squirrel/sqclass.h | 6 +++--- src/3rdparty/squirrel/squirrel/sqclosure.h | 18 +++++++++--------- src/3rdparty/squirrel/squirrel/sqfuncproto.h | 2 +- src/3rdparty/squirrel/squirrel/sqobject.h | 4 ++-- src/3rdparty/squirrel/squirrel/sqstring.h | 2 +- src/3rdparty/squirrel/squirrel/squserdata.h | 6 +++--- src/3rdparty/squirrel/squirrel/sqvm.h | 6 +++--- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/3rdparty/squirrel/squirrel/sqclass.h b/src/3rdparty/squirrel/squirrel/sqclass.h index 2d850ac908..b1b8fa5c63 100644 --- a/src/3rdparty/squirrel/squirrel/sqclass.h +++ b/src/3rdparty/squirrel/squirrel/sqclass.h @@ -55,13 +55,13 @@ public: bool SetAttributes(const SQObjectPtr &key,const SQObjectPtr &val); bool GetAttributes(const SQObjectPtr &key,SQObjectPtr &outval); void Lock() { _locked = true; if(_base) _base->Lock(); } - void Release() { + void Release() override { if (_hook) { _hook(_typetag,0);} sq_delete(this, SQClass); } - void Finalize(); + void Finalize() override; #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; #endif SQInteger Next(const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval); SQInstance *CreateInstance(); diff --git a/src/3rdparty/squirrel/squirrel/sqclosure.h b/src/3rdparty/squirrel/squirrel/sqclosure.h index 49a84b7924..671e47c1be 100644 --- a/src/3rdparty/squirrel/squirrel/sqclosure.h +++ b/src/3rdparty/squirrel/squirrel/sqclosure.h @@ -14,7 +14,7 @@ public: new (nc) SQClosure(ss,func); return nc; } - void Release(){ + void Release() override { sq_delete(this,SQClosure); } SQClosure *Clone() @@ -32,8 +32,8 @@ public: bool Save(SQVM *v,SQUserPointer up,SQWRITEFUNC write); static bool Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr &ret); #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_outervalues.resize(0); } + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_outervalues.resize(0); } #endif SQObjectPtr _env; SQObjectPtr _function; @@ -60,14 +60,14 @@ public: _state=eDead; _stack.resize(0); _closure=_null_;} - void Release(){ + void Release() override { sq_delete(this,SQGenerator); } bool Yield(SQVM *v); bool Resume(SQVM *v,SQInteger target); #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_stack.resize(0);_closure=_null_;} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_stack.resize(0);_closure=_null_;} #endif SQObjectPtr _closure; SQObjectPtrVec _stack; @@ -102,12 +102,12 @@ public: { REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain,this); } - void Release(){ + void Release() override { sq_delete(this,SQNativeClosure); } #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_outervalues.resize(0);} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_outervalues.resize(0);} #endif SQInteger _nparamscheck; SQIntVec _typecheck; diff --git a/src/3rdparty/squirrel/squirrel/sqfuncproto.h b/src/3rdparty/squirrel/squirrel/sqfuncproto.h index 2966d06544..b65b040b49 100644 --- a/src/3rdparty/squirrel/squirrel/sqfuncproto.h +++ b/src/3rdparty/squirrel/squirrel/sqfuncproto.h @@ -103,7 +103,7 @@ public: new (f) SQFunctionProto(ninstructions, nliterals, nparameters, nfunctions, noutervalues, nlineinfos, nlocalvarinfos, ndefaultparams); return f; } - void Release(){ + void Release() override { _DESTRUCT_VECTOR(SQObjectPtr,_nliterals,_literals); _DESTRUCT_VECTOR(SQObjectPtr,_nparameters,_parameters); _DESTRUCT_VECTOR(SQObjectPtr,_nfunctions,_functions); diff --git a/src/3rdparty/squirrel/squirrel/sqobject.h b/src/3rdparty/squirrel/squirrel/sqobject.h index d19aed1f45..03d6dcca34 100644 --- a/src/3rdparty/squirrel/squirrel/sqobject.h +++ b/src/3rdparty/squirrel/squirrel/sqobject.h @@ -84,7 +84,7 @@ private: struct SQWeakRef : SQRefCounted { - void Release(); + void Release() override; SQObject _obj; }; @@ -362,7 +362,7 @@ struct SQCollectable : public SQRefCounted { SQCollectable *_next; SQCollectable *_prev; SQSharedState *_sharedstate; - virtual void Release()=0; + void Release() override=0; virtual void EnqueueMarkObjectForChildren(class SQGCMarkerQueue &queue)=0; void UnMark(); virtual void Finalize()=0; diff --git a/src/3rdparty/squirrel/squirrel/sqstring.h b/src/3rdparty/squirrel/squirrel/sqstring.h index 1d20d0b610..4d14e4adb4 100644 --- a/src/3rdparty/squirrel/squirrel/sqstring.h +++ b/src/3rdparty/squirrel/squirrel/sqstring.h @@ -19,7 +19,7 @@ public: static SQString *Create(SQSharedState *ss, const SQChar *, SQInteger len = -1 ); static SQString *Create(SQSharedState *ss, const std::string &str) { return Create(ss, str.data(), str.size()); } SQInteger Next(const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval); - void Release(); + void Release() override; SQSharedState *_sharedstate; SQString *_next; //chain for the string table SQInteger _len; diff --git a/src/3rdparty/squirrel/squirrel/squserdata.h b/src/3rdparty/squirrel/squirrel/squserdata.h index aed3e83498..de75ca3c37 100644 --- a/src/3rdparty/squirrel/squirrel/squserdata.h +++ b/src/3rdparty/squirrel/squirrel/squserdata.h @@ -18,10 +18,10 @@ struct SQUserData : SQDelegable return ud; } #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){SetDelegate(nullptr);} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {SetDelegate(nullptr);} #endif - void Release() { + void Release() override { if (_hook) _hook(_val,_size); SQInteger tsize = _size - 1; this->~SQUserData(); diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h index 86ac4aacdc..d38c1e461f 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.h +++ b/src/3rdparty/squirrel/squirrel/sqvm.h @@ -112,16 +112,16 @@ public: #endif #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; #endif - void Finalize(); + void Finalize() override; void GrowCallStack() { SQInteger newsize = _alloccallsstacksize*2; _callstackdata.resize(newsize); _callsstack = &_callstackdata[0]; _alloccallsstacksize = newsize; } - void Release(){ sq_delete(this,SQVM); } //does nothing + void Release() override { sq_delete(this,SQVM); } //does nothing //////////////////////////////////////////////////////////////////////////// //stack functions for the api void Remove(SQInteger n); From 890146fecb170cb1d89d9ffee63a90159063f33c Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Mon, 25 Sep 2023 13:02:51 +0100 Subject: [PATCH 52/59] Codechange: Add -Wsuggest-override compilation flag. --- cmake/CompileFlags.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index acf2c2180e..7cdbc42c96 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -63,6 +63,7 @@ macro(compile_flags) -Wformat=2 -Winit-self -Wnon-virtual-dtor + -Wsuggest-override # We use 'ABCD' multichar for SaveLoad chunks identifiers -Wno-multichar From beafdadde452b41042d5c552330d4418ce06ffe2 Mon Sep 17 00:00:00 2001 From: translators Date: Tue, 26 Sep 2023 18:39:04 +0000 Subject: [PATCH 53/59] Update: Translations from eints italian: 25 changes by Rivarossi --- src/lang/italian.txt | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 3673445fee..a886316fa9 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -525,6 +525,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Elimina tutti i # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informazioni sull'area di terreno +STR_ABOUT_MENU_HELP :Aiuto e manuali STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Apri/chiudi console STR_ABOUT_MENU_AI_DEBUG :Debug IA/Script @@ -1461,6 +1462,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :Nessuno* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Ridotto STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normale +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :Consenti passaggi a livello con strade o ferrovie di proprietà dei concorrenti: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :Consenti la realizzazione di passaggi a livello su strade o rotaie di proprietà dei concorrenti STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Consenti fermate passanti sulle strade di proprietà delle città: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Permettere la costruzione di fermate stradali passanti sulle strade di proprietà delle città. @@ -2157,6 +2160,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Multigio STR_INTRO_GAME_OPTIONS :{BLACK}Opzioni di gioco STR_INTRO_HIGHSCORE :{BLACK}Punteggi migliori +STR_INTRO_HELP :{BLACK}Aiuto e manuali STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Impostazioni STR_INTRO_NEWGRF_SETTINGS :{BLACK}Impostazioni NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Contenuti online @@ -2178,6 +2182,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Selezion STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Mostra le opzioni di gioco STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Mostra la tabella dei punteggi migliori +STR_INTRO_TOOLTIP_HELP :{BLACK}Ottieni l'accesso alla documentazione e alle risorse online STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Mostra le impostazioni STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Mostra le impostazioni NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Controlla la disponibilità di contenuti nuovi o aggiornati da scaricare @@ -2200,6 +2205,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Si è s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Si è sicuri di voler abbandonare questo scenario? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Aiuto e manuali +STR_HELP_WINDOW_WEBSITES :{BLACK}Siti web +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Documenti +STR_HELP_WINDOW_README :{BLACK}Leggimi +STR_HELP_WINDOW_CHANGELOG :{BLACK}Changelog +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Bug conosciuti +STR_HELP_WINDOW_LICENSE :{BLACK}Licenza +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manuale / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Segnala un bug +STR_HELP_WINDOW_COMMUNITY :{BLACK}Community # Cheat window STR_CHEATS :{WHITE}Trucchi @@ -2688,6 +2704,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}Attiva/d STR_TRANSPARENT_BRIDGES_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza dei ponti. CTRL+clic per bloccare STR_TRANSPARENT_STRUCTURES_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza di strutture come fari e antenne. CTRL+clic per bloccare STR_TRANSPARENT_CATENARY_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza delle catenarie. CTRL+clic per bloccare +STR_TRANSPARENT_TEXT_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza per il caricamento e il testo costi/entrate. Ctrl+clic per bloccare STR_TRANSPARENT_INVISIBLE_TOOLTIP :{BLACK}Rendi gli oggetti invisibili invece che trasparenti # Linkgraph legend window @@ -3268,7 +3285,7 @@ STR_MAPGEN_NEWGRF_SETTINGS_TOOLTIP :{BLACK}Mostra i STR_MAPGEN_AI_SETTINGS :{BLACK}Impostazioni IA STR_MAPGEN_AI_SETTINGS_TOOLTIP :{BLACK}Mostra impostazioni IA STR_MAPGEN_GS_SETTINGS :{BLACK}Impostazioni script di gioco -STR_MAPGEN_GS_SETTINGS_TOOLTIP :BLACK}Visualizza le impostazioni dello script di gioco +STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}Visualizza le impostazioni dello script di gioco ###length 21 STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :Inglesi (originali) @@ -3424,6 +3441,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Ispezion STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} a {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Oggetto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo di rotaie +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo di strada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parametro variabile NewGRF 60+x (esadecimale) @@ -4739,6 +4757,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Sommario +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Passa rapidamente a una sezione del file visualizzato tramite questo elenco +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Torna indietro nella cronologia di navigazione +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Vai avanti nella cronologia di navigazione STR_TEXTFILE_WRAP_TEXT :{WHITE}A capo automatico STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Manda automaticamente a capo il testo della finestra in modo che sia visibile senza doverlo scorrere STR_TEXTFILE_VIEW_README :{BLACK}Visualizza file leggimi @@ -4749,6 +4772,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}File leg STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Changelog del {STRING} {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Licenza del {STRING} {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Anteprima del risultato del sondaggio +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Documento OpenTTD '{STRING}' # Vehicle loading indicators From fd79d34ba96ab4372519526adcfcc25dab105767 Mon Sep 17 00:00:00 2001 From: translators Date: Wed, 27 Sep 2023 18:39:05 +0000 Subject: [PATCH 54/59] Update: Translations from eints korean: 1 change by telk5093 --- src/lang/korean.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 83cc956c76..3699b81f31 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}상위 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING}, {HEX}에서 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :오브젝트 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :철도 종류 +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :도로 종류 STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF 변수 60+x 매개 변수 (16진법) From b5dc9328f20bd7e043950174f932006e4e83bfa0 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Sat, 30 Sep 2023 12:30:25 +0100 Subject: [PATCH 55/59] Change: Store station blocked/wires/pylons flags in map. (#11337) This stores three flags in unused map bits, and avoids having to look up station graphics and custom station specs to determine blocked/wires/pylons status. This potentially affects rail pathfinding performance. Savegame version is not bumped, as the flags can just be updated every time. --- docs/landscape.html | 3 ++ docs/landscape_grid.html | 2 +- src/newgrf_station.cpp | 40 ------------------- src/saveload/afterload.cpp | 21 ++++++++++ src/station_cmd.cpp | 13 ++++++- src/station_func.h | 6 --- src/station_map.h | 78 ++++++++++++++++++++++++++++++++++++-- src/waypoint_cmd.cpp | 12 ++++++ 8 files changed, 124 insertions(+), 51 deletions(-) diff --git a/docs/landscape.html b/docs/landscape.html index 99243101e6..f592cd0f6a 100644 --- a/docs/landscape.html +++ b/docs/landscape.html @@ -989,8 +989,11 @@ +
  • m6 bit 7: rail station / waypoint may have catenary pylons
  • +
  • m6 bit 6: rail station / waypoint may have catenary wires
  • m6 bits 5..3: the station type (rail, airport, truck, bus, oilrig, dock, buoy, waypoint)
  • m6 bit 2: pbs reservation state for railway stations/waypoints
  • +
  • m6 bit 0: rail station / waypoint is blocked
  • m7 bits 4..0: owner of road (road stops)
  • m7: animation frame (railway stations/waypoints, airports)
  • diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index e7e55aabf3..a0fa527a6b 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -188,7 +188,7 @@ the array so you can quickly see what is used and what is not. XXXX OOOO XXXX XXXX XXXX XXXX - OOXXX XOO + XXXXX XOX XXXX XXXX OOOO OOOO OOXX XXXX diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 5fb5ceb752..17f38d2cb8 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -840,46 +840,6 @@ const StationSpec *GetStationSpec(TileIndex t) return specindex < st->speclist.size() ? st->speclist[specindex].spec : nullptr; } - -/** - * Check whether a rail station tile is NOT traversable. - * @param tile %Tile to test. - * @return Station tile is blocked. - * @note This could be cached (during build) in the map array to save on all the dereferencing. - */ -bool IsStationTileBlocked(TileIndex tile) -{ - const StationSpec *statspec = GetStationSpec(tile); - - return statspec != nullptr && HasBit(statspec->blocked, GetStationGfx(tile)); -} - -/** - * Check if a rail station tile shall have pylons when electrified. - * @param tile %Tile to test. - * @return Tile shall have pylons. - * @note This could be cached (during build) in the map array to save on all the dereferencing. - */ -bool CanStationTileHavePylons(TileIndex tile) -{ - const StationSpec *statspec = GetStationSpec(tile); - uint gfx = GetStationGfx(tile); - /* Default stations do not draw pylons under roofs (gfx >= 4) */ - return statspec != nullptr ? HasBit(statspec->pylons, gfx) : gfx < 4; -} - -/** - * Check if a rail station tile shall have wires when electrified. - * @param tile %Tile to test. - * @return Tile shall have wires. - * @note This could be cached (during build) in the map array to save on all the dereferencing. - */ -bool CanStationTileHaveWires(TileIndex tile) -{ - const StationSpec *statspec = GetStationSpec(tile); - return statspec == nullptr || !HasBit(statspec->wires, GetStationGfx(tile)); -} - /** Wrapper for animation control, see GetStationCallback. */ uint16_t GetAnimStationCallback(CallbackID callback, uint32_t param1, uint32_t param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int) { diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 24ed09283b..714b0332c1 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -47,6 +47,7 @@ #include "../subsidy_base.h" #include "../subsidy_func.h" #include "../newgrf.h" +#include "../newgrf_station.h" #include "../engine_func.h" #include "../rail_gui.h" #include "../core/backup_type.hpp" @@ -2856,6 +2857,26 @@ bool AfterLoadGame() _settings_game.script.settings_profile = IsInsideMM(_old_diff_level, SP_BEGIN, SP_END) ? _old_diff_level : (uint)SP_MEDIUM; } + { + /* Station blocked, wires and pylon flags need to be stored in the map. This is effectively cached data, so no + * version check is necessary. This is done here as the SLV_182 check below needs the blocked status. */ + for (auto t : Map::Iterate()) { + if (HasStationTileRail(t)) { + StationGfx gfx = GetStationGfx(t); + const StationSpec *statspec = GetStationSpec(t); + + bool blocked = statspec != nullptr && HasBit(statspec->blocked, gfx); + /* Default stations do not draw pylons under roofs (gfx >= 4) */ + bool pylons = statspec != nullptr ? HasBit(statspec->pylons, gfx) : gfx < 4; + bool wires = statspec == nullptr || !HasBit(statspec->wires, gfx); + + SetStationTileBlocked(t, blocked); + SetStationTileHavePylons(t, pylons); + SetStationTileHaveWires(t, wires); + } + } + } + if (IsSavegameVersionBefore(SLV_182)) { /* Aircraft acceleration variable was bonkers */ for (Aircraft *v : Aircraft::Iterate()) { diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 12c30a33b8..683b94e6cc 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1466,7 +1466,18 @@ CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailTyp SetStationTileRandomBits(tile, GB(Random(), 0, 4)); SetAnimationFrame(tile, 0); - if (!IsStationTileBlocked(tile)) c->infrastructure.rail[rt]++; + /* Should be the same as layout but axis component could be wrong... */ + StationGfx gfx = GetStationGfx(tile); + bool blocked = statspec != nullptr && HasBit(statspec->blocked, gfx); + /* Default stations do not draw pylons under roofs (gfx >= 4) */ + bool pylons = statspec != nullptr ? HasBit(statspec->pylons, gfx) : gfx < 4; + bool wires = statspec == nullptr || !HasBit(statspec->wires, gfx); + + SetStationTileBlocked(tile, blocked); + SetStationTileHavePylons(tile, pylons); + SetStationTileHaveWires(tile, wires); + + if (!blocked) c->infrastructure.rail[rt]++; c->infrastructure.station++; if (statspec != nullptr) { diff --git a/src/station_func.h b/src/station_func.h index 8e72a945f7..4268569316 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -43,12 +43,6 @@ void UpdateStationDockingTiles(Station *st); void RemoveDockingTile(TileIndex t); void ClearDockingTilesCheckingNeighbours(TileIndex tile); -/* Check if a rail station tile is traversable. */ -bool IsStationTileBlocked(TileIndex tile); - -bool CanStationTileHavePylons(TileIndex tile); -bool CanStationTileHaveWires(TileIndex tile); - void UpdateAirportsNoise(); bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset); diff --git a/src/station_map.h b/src/station_map.h index 7eee619e02..ed21c71848 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -329,6 +329,78 @@ static inline bool IsHangarTile(Tile t) return IsTileType(t, MP_STATION) && IsHangar(t); } +/** + * Is tile \a t a blocked tile? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile is blocked + */ +static inline bool IsStationTileBlocked(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 0); +} + +/** + * Set the blocked state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the blocked state + */ +static inline void SetStationTileBlocked(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 0, 1, b ? 1 : 0); +} + +/** + * Can tile \a t have catenary wires? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile can have catenary wires + */ +static inline bool CanStationTileHaveWires(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 6); +} + +/** + * Set the catenary wires state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the catenary wires state + */ +static inline void SetStationTileHaveWires(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 6, 1, b ? 1 : 0); +} + +/** + * Can tile \a t have catenary pylons? + * @pre HasStationRail(t) + * @param t Tile to check + * @return \c true if the tile can have catenary pylons + */ +static inline bool CanStationTileHavePylons(Tile t) +{ + assert(HasStationRail(t)); + return HasBit(t.m6(), 7); +} + +/** + * Set the catenary pylon state of the rail station + * @pre HasStationRail(t) + * @param t the station tile + * @param b the catenary pylons state + */ +static inline void SetStationTileHavePylons(Tile t, bool b) +{ + assert(HasStationRail(t)); + SB(t.m6(), 7, 1, b ? 1 : 0); +} + /** * Get the rail direction of a rail station. * @param t Tile to query @@ -379,10 +451,10 @@ static inline TrackBits GetRailStationTrackBits(Tile t) static inline bool IsCompatibleTrainStationTile(Tile test_tile, Tile station_tile) { assert(IsRailStationTile(station_tile)); - return IsRailStationTile(test_tile) && IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) && + return IsRailStationTile(test_tile) && !IsStationTileBlocked(test_tile) && + IsCompatibleRail(GetRailType(test_tile), GetRailType(station_tile)) && GetRailStationAxis(test_tile) == GetRailStationAxis(station_tile) && - GetStationIndex(test_tile) == GetStationIndex(station_tile) && - !IsStationTileBlocked(test_tile); + GetStationIndex(test_tile) == GetStationIndex(station_tile); } /** diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 11da28b6dd..cfc5500230 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -277,6 +277,18 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlag flags, TileIndex start_tile, Axis HasStationReservation(tile); MakeRailWaypoint(tile, wp->owner, wp->index, axis, layout_ptr[i], GetRailType(tile)); SetCustomStationSpecIndex(tile, map_spec_index); + + /* Should be the same as layout but axis component could be wrong... */ + StationGfx gfx = GetStationGfx(tile); + bool blocked = spec != nullptr && HasBit(spec->blocked, gfx); + /* Default stations do not draw pylons under roofs (gfx >= 4) */ + bool pylons = spec != nullptr ? HasBit(spec->pylons, gfx) : gfx < 4; + bool wires = spec == nullptr || !HasBit(spec->wires, gfx); + + SetStationTileBlocked(tile, blocked); + SetStationTileHavePylons(tile, pylons); + SetStationTileHaveWires(tile, wires); + SetRailStationReservation(tile, reserved); MarkTileDirtyByTile(tile); From c84219a42ee04582b0897bb7c6afc754d2223cce Mon Sep 17 00:00:00 2001 From: translators Date: Sat, 30 Sep 2023 18:37:10 +0000 Subject: [PATCH 56/59] Update: Translations from eints english (us): 1 change by 2TallTyler vietnamese: 21 changes by KhoiCanDev --- src/lang/english_US.txt | 1 + src/lang/vietnamese.txt | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index fc67ddba7d..b510cf53d6 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 0d54733222..28626fba82 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -523,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Xoá tất cả # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Thông tin vùng đất +STR_ABOUT_MENU_HELP :Trợ giúp & hướng dẫn STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Bật/tắt bảng lệnh STR_ABOUT_MENU_AI_DEBUG :Gỡ rối AI / Game script @@ -2124,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Nhiều STR_INTRO_GAME_OPTIONS :{BLACK}Cấu Hình Trò Chơi STR_INTRO_HIGHSCORE :{BLACK}Bảng điểm chơi cao nhất +STR_INTRO_HELP :{BLACK}Trợ giúp & hướng dẫn STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Thiết lập STR_INTRO_NEWGRF_SETTINGS :{BLACK}Thiết Lập NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Các Nội Dung Trên Mạng @@ -2145,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Chọn k STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Hiển thị cấu hình của trò chơi STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hiện bảng điểm chơi cao nhất +STR_INTRO_TOOLTIP_HELP :{BLACK}Truy cập vào tài liệu và tài nguyên trực tuyến STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Thiết lập hiển thị STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Hiển thị tùy chỉnh NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Kiểm tra những nội dung mới & cập nhật để tải về @@ -2167,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Bạn c STR_ABANDON_SCENARIO_QUERY :{YELLOW}Bạn có chắc bạn muốn bỏ màn chơi kịch bản này? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Trợ giúp & hướng dẫn +STR_HELP_WINDOW_WEBSITES :{BLACK}Websites +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Tài liệu +STR_HELP_WINDOW_README :{BLACK}Readme +STR_HELP_WINDOW_CHANGELOG :{BLACK}Lịch sử thay đổi +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Các lỗi đã biết +STR_HELP_WINDOW_LICENSE :{BLACK}Giấy phép +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Hướng dẫn / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Báo cáo lỗi +STR_HELP_WINDOW_COMMUNITY :{BLACK}Cộng đồng # Cheat window STR_CHEATS :{WHITE}Cheats @@ -3386,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Phân t STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} tại {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Đối Tượng STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Kiểu ray +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Loại đường STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Biến số NewGRF là 60+x (dạng hexa) @@ -4701,6 +4716,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Danh mục +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Dùng danh sách này để chuyển nhanh tới một phần trong tập tin được hiển thị +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Trở về trước trong lịch sử điều hướng +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Trở về sau trong lịch sử điều hướng STR_TEXTFILE_WRAP_TEXT :{WHITE}Ép văn bản STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ép chữ cái vừa khung cửa sổ để khỏi phải cuộn chuột STR_TEXTFILE_VIEW_README :{BLACK}Xem readme @@ -4711,6 +4731,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}Readme c STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Lịch sử thay đổi của {STRING} {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Giấy phép của {STRING} {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Xem trước kết quả khảo sát +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Tài liệu OpenTTD '{STRING}' # Vehicle loading indicators From d75a5e1a9ad44b4fcf37dd0a2c604c622227a0e1 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 1 Oct 2023 14:15:05 +0200 Subject: [PATCH 57/59] Fix: Upgrading NewGRF presets could result in incomplete display of NewGRF parameters until restart. --- src/newgrf_config.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 5bc4fb5182..8985f4c181 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -73,7 +73,6 @@ GRFConfig::GRFConfig(const GRFConfig &config) : void GRFConfig::CopyParams(const GRFConfig &src) { this->num_params = src.num_params; - this->num_valid_params = src.num_valid_params; this->param = src.param; } From 82c87208146e11f26c2dbc1aa647bb38c7da7458 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 1 Oct 2023 15:21:57 +0200 Subject: [PATCH 58/59] Fix #8846: When upgrading NewGRF presets, copy NewGRF parameters only if the NewGRF are compatible. Otherwise reset to defaults. --- src/newgrf_config.cpp | 10 +++++++++- src/newgrf_config.h | 1 + src/newgrf_gui.cpp | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 8985f4c181..c45498ee2b 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -66,6 +66,14 @@ GRFConfig::GRFConfig(const GRFConfig &config) : { } +/** + * Return whether this NewGRF can replace an older version of the same NewGRF. + */ +bool GRFConfig::IsCompatible(uint32_t old_version) const +{ + return this->min_loadable_version <= old_version && old_version <= this->version; +} + /** * Copy the parameter information from the \a src config. * @param src Source config. @@ -685,7 +693,7 @@ const GRFConfig *FindGRFConfig(uint32_t grfid, FindGRFConfigMode mode, const MD5 /* Skip incompatible stuff, unless explicitly allowed */ if (mode != FGCM_NEWEST && HasBit(c->flags, GCF_INVALID)) continue; /* check version compatibility */ - if (mode == FGCM_COMPATIBLE && (c->version < desired_version || c->min_loadable_version > desired_version)) continue; + if (mode == FGCM_COMPATIBLE && !c->IsCompatible(desired_version)) continue; /* remember the newest one as "the best" */ if (best == nullptr || c->version > best->version) best = c; } diff --git a/src/newgrf_config.h b/src/newgrf_config.h index 22706ce025..3620501b19 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -173,6 +173,7 @@ struct GRFConfig : ZeroedMemoryAllocator { struct GRFConfig *next; ///< NOSAVE: Next item in the linked list + bool IsCompatible(uint32_t old_version) const; void CopyParams(const GRFConfig &src); std::optional GetTextfile(TextfileType type) const; diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 9aab5e9b6f..f1ec5e3f7f 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -723,7 +723,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { while (*c != iter->second) c = &(*c)->next; GRFConfig *d = new GRFConfig(*a); d->next = (*c)->next; - d->CopyParams(**c); + if (d->IsCompatible((*c)->version)) { + d->CopyParams(**c); + } else { + d->SetParameterDefaults(); + } if (this->active_sel == *c) { CloseWindowByClass(WC_GRF_PARAMETERS); CloseWindowByClass(WC_TEXTFILE); From 077b08bbfa2500e8dec3fca697600072ae84c247 Mon Sep 17 00:00:00 2001 From: merni-ns <66267867+merni-ns@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:28:44 +0530 Subject: [PATCH 59/59] Fix #11261: Set number of items correctly when choosing available airport set (#11344) --- src/airport_gui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index 9218c9446a..aa53eed6b9 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -544,13 +544,14 @@ public: } if (change_class) { /* If that fails, select the first available airport - * from a random class. */ + * from the first class where airports are available. */ for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) { AirportClass *apclass = AirportClass::Get(j); for (uint i = 0; i < apclass->GetSpecCount(); i++) { const AirportSpec *as = apclass->GetSpec(i); if (as->IsAvailable()) { _selected_airport_class = j; + this->vscroll->SetCount(apclass->GetSpecCount()); this->SelectOtherAirport(i); return; }