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_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 *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_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 *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_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 ***/