diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 9b2eeed4fb..d0d0c28fd9 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -86,10 +86,15 @@ jobs: fail-fast: false matrix: include: - - name: Clang + - name: Clang - Debug compiler: clang cxxcompiler: clang++ libraries: libsdl2-dev + - name: Clang - Release + compiler: clang + cxxcompiler: clang++ + libraries: libsdl2-dev + extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF - name: GCC - SDL2 compiler: gcc cxxcompiler: g++ diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 01a332fb10..9d63989b80 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -54,7 +54,6 @@ jobs: liblzma-dev \ liblzo2-dev \ libsdl2-dev \ - nlohmann-json3-dev \ zlib1g-dev \ # EOF echo "::endgroup::" diff --git a/README.md b/README.md index 38faff3a20..cb483a789c 100644 --- a/README.md +++ b/README.md @@ -573,6 +573,12 @@ See the comments in the source files in `src/3rdparty/md5` for the complete lice The fmt implementation in `src/3rdparty/fmt` is licensed under the MIT license. See `src/3rdparty/fmt/LICENSE.rst` for the complete license text. +The nlohmann json implementation in `src/3rdparty/nlohmann` is licensed under the MIT license. +See `src/3rdparty/nlohmann/LICENSE.MIT` for the complete license text. + +The OpenGL API in `src/3rdparty/opengl` is licensed under the MIT license. +See `src/3rdparty/opengl/khrplatform.h` for the complete license text. + The catch2 implementation in `src/3rdparty/catch2` is licensed under the Boost Software License, Version 1.0. See `src/3rdparty/catch2/LICENSE.txt` for the complete license text. diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index 2aefff06e4..ef0058661f 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -41,7 +41,11 @@ macro(compile_flags) #set(IS_STABLE_RELEASE "$>,$>>") if(MSVC) - add_compile_options(/W3) + add_compile_options( + /W3 + #/w34100 # 'identifier' : unreferenced formal parameter + /w34189 # 'identifier' : local variable is initialized but not referenced + ) if(MSVC_VERSION GREATER 1929 AND MSVC_VERSION LESS 1937 AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") # Starting with version 19.30 (fixed in version 19.37), there is an optimisation bug, see #9966 for details # This flag disables the broken optimisation to work around the bug @@ -62,6 +66,7 @@ macro(compile_flags) -Wformat=2 -Winit-self "$<$:-Wnon-virtual-dtor>" + "$<$:-Wsuggest-override>" # Often parameters are unused, which is fine. -Wno-unused-parameter @@ -89,22 +94,6 @@ macro(compile_flags) endif() endif(NOT CMAKE_BUILD_TYPE) - # When we are a stable release (Release build + USE_ASSERTS not set), - # assertations are off, which trigger a lot of warnings. We disable - # these warnings for these releases. - #if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # add_compile_options( - # "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>" - # "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-parameter>" - # "$<${IS_STABLE_RELEASE}:-Wno-unused-but-set-variable>" - # ) - #else (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # add_compile_options( - # "$<${IS_STABLE_RELEASE}:-Wno-unused-variable>" - # "$<${IS_STABLE_RELEASE}:-Wno-unused-parameter>" - # ) - #endif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - # Ninja processes the output so the output from the compiler # isn't directly to a terminal; hence, the default is # non-coloured output. We can override this to get nicely diff --git a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp index b6efa13148..300fed08e9 100644 --- a/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp +++ b/src/3rdparty/squirrel/sqstdlib/sqstdstring.cpp @@ -1,7 +1,6 @@ /* see copyright notice in squirrel.h */ #include #include -#include #define scstrchr strchr #define scatoi atoi diff --git a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp index 8dff3daf0e..c60bd3fe2e 100644 --- a/src/3rdparty/squirrel/squirrel/sqbaselib.cpp +++ b/src/3rdparty/squirrel/squirrel/sqbaselib.cpp @@ -12,7 +12,6 @@ #include "sqfuncproto.h" #include "sqclosure.h" #include "sqclass.h" -#include #include #include "../../../safeguards.h" @@ -559,7 +558,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 15c9c60caf..92f1410eec 100644 --- a/src/3rdparty/squirrel/squirrel/sqclass.cpp +++ b/src/3rdparty/squirrel/squirrel/sqclass.cpp @@ -185,7 +185,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/sqclass.h b/src/3rdparty/squirrel/squirrel/sqclass.h index 7d4b60aa83..fe6ad7c55b 100644 --- a/src/3rdparty/squirrel/squirrel/sqclass.h +++ b/src/3rdparty/squirrel/squirrel/sqclass.h @@ -54,13 +54,13 @@ public: bool SetAttributes(const SQObjectPtr &key,const SQObjectPtr &val); bool GetAttributes(const SQObjectPtr &key,SQObjectPtr &outval); void Lock() { _locked = true; if(_base) _base->Lock(); } - void Release() { + void Release() override { if (_hook) { _hook(_typetag,0);} sq_delete_refcounted(this, SQClass); } - void Finalize(); + void Finalize() override; #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; #endif SQInteger Next(const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval); SQInstance *CreateInstance(); diff --git a/src/3rdparty/squirrel/squirrel/sqclosure.h b/src/3rdparty/squirrel/squirrel/sqclosure.h index 5e07f88f57..f0ca58adb5 100644 --- a/src/3rdparty/squirrel/squirrel/sqclosure.h +++ b/src/3rdparty/squirrel/squirrel/sqclosure.h @@ -13,7 +13,7 @@ public: SQClosure *nc = new (SQAllocationTag{}) SQClosure(ss,func); return nc; } - void Release(){ + void Release() override { sq_delete_refcounted(this,SQClosure); } SQClosure *Clone() @@ -31,8 +31,8 @@ public: bool Save(SQVM *v,SQUserPointer up,SQWRITEFUNC write); static bool Load(SQVM *v,SQUserPointer up,SQREADFUNC read,SQObjectPtr &ret); #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_outervalues.resize(0); } + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_outervalues.resize(0); } #endif SQObjectPtr _env; SQObjectPtr _function; @@ -58,14 +58,14 @@ public: _state=eDead; _stack.resize(0); _closure=_null_;} - void Release(){ + void Release() override { sq_delete_refcounted(this,SQGenerator); } bool Yield(SQVM *v); bool Resume(SQVM *v,SQInteger target); #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_stack.resize(0);_closure=_null_;} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_stack.resize(0);_closure=_null_;} #endif SQObjectPtr _closure; SQObjectPtrVec _stack; @@ -99,12 +99,12 @@ public: { REMOVE_FROM_CHAIN(&_ss(this)->_gc_chain,this); } - void Release(){ + void Release() override { sq_delete_refcounted(this,SQNativeClosure); } #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){_outervalues.resize(0);} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {_outervalues.resize(0);} #endif SQInteger _nparamscheck; SQIntVec _typecheck; diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp index 86fe8a4b3b..57ca40ac06 100644 --- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp +++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp @@ -6,7 +6,6 @@ #include #include "sqpcheader.h" -#include #include "sqopcodes.h" #include "sqstring.h" #include "sqfuncproto.h" diff --git a/src/3rdparty/squirrel/squirrel/sqfuncproto.h b/src/3rdparty/squirrel/squirrel/sqfuncproto.h index f03990a313..271f1afd0b 100644 --- a/src/3rdparty/squirrel/squirrel/sqfuncproto.h +++ b/src/3rdparty/squirrel/squirrel/sqfuncproto.h @@ -102,7 +102,7 @@ public: SQFunctionProto *f = new (SQSizedAllocationTag(size)) SQFunctionProto(ninstructions, nliterals, nparameters, nfunctions, noutervalues, nlineinfos, nlocalvarinfos, ndefaultparams); return f; } - void Release(){ + void Release() override { _DESTRUCT_VECTOR(SQObjectPtr,_nliterals,_literals); _DESTRUCT_VECTOR(SQObjectPtr,_nparameters,_parameters); _DESTRUCT_VECTOR(SQObjectPtr,_nfunctions,_functions); diff --git a/src/3rdparty/squirrel/squirrel/sqobject.h b/src/3rdparty/squirrel/squirrel/sqobject.h index 2787345c51..a20fb4d639 100644 --- a/src/3rdparty/squirrel/squirrel/sqobject.h +++ b/src/3rdparty/squirrel/squirrel/sqobject.h @@ -113,7 +113,7 @@ struct SQRefCounted struct SQWeakRef : SQRefCounted { - void Release(); + void Release() override; SQObject _obj; }; @@ -391,7 +391,7 @@ struct SQCollectable : public SQRefCounted { SQCollectable *_next; SQCollectable *_prev; SQSharedState *_sharedstate; - virtual void Release()=0; + void Release() override=0; virtual void EnqueueMarkObjectForChildren(class SQGCMarkerQueue &queue)=0; void UnMark(); virtual void Finalize()=0; diff --git a/src/3rdparty/squirrel/squirrel/sqstate.cpp b/src/3rdparty/squirrel/squirrel/sqstate.cpp index 54197aa084..112b1bb612 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/3rdparty/squirrel/squirrel/sqstring.h b/src/3rdparty/squirrel/squirrel/sqstring.h index 1d20d0b610..4d14e4adb4 100644 --- a/src/3rdparty/squirrel/squirrel/sqstring.h +++ b/src/3rdparty/squirrel/squirrel/sqstring.h @@ -19,7 +19,7 @@ public: static SQString *Create(SQSharedState *ss, const SQChar *, SQInteger len = -1 ); static SQString *Create(SQSharedState *ss, const std::string &str) { return Create(ss, str.data(), str.size()); } SQInteger Next(const SQObjectPtr &refpos, SQObjectPtr &outkey, SQObjectPtr &outval); - void Release(); + void Release() override; SQSharedState *_sharedstate; SQString *_next; //chain for the string table SQInteger _len; diff --git a/src/3rdparty/squirrel/squirrel/squserdata.h b/src/3rdparty/squirrel/squirrel/squserdata.h index 7f78926f94..c309e6d9ae 100644 --- a/src/3rdparty/squirrel/squirrel/squserdata.h +++ b/src/3rdparty/squirrel/squirrel/squserdata.h @@ -17,10 +17,10 @@ struct SQUserData : SQDelegable return ud; } #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); - void Finalize(){SetDelegate(nullptr);} + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; + void Finalize() override {SetDelegate(nullptr);} #endif - void Release() { + void Release() override { if (_hook) _hook(_val,_size); sq_delete_refcounted(this, SQUserData); } diff --git a/src/3rdparty/squirrel/squirrel/sqvm.h b/src/3rdparty/squirrel/squirrel/sqvm.h index bc7105ad2c..2ac19e2da7 100644 --- a/src/3rdparty/squirrel/squirrel/sqvm.h +++ b/src/3rdparty/squirrel/squirrel/sqvm.h @@ -112,16 +112,16 @@ public: #endif #ifndef NO_GARBAGE_COLLECTOR - void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue); + void EnqueueMarkObjectForChildren(SQGCMarkerQueue &queue) override; #endif - void Finalize(); + void Finalize() override; void GrowCallStack() { SQInteger newsize = _alloccallsstacksize*2; _callstackdata.resize(newsize); _callsstack = &_callstackdata[0]; _alloccallsstacksize = newsize; } - void Release(){ sq_delete_refcounted(this,SQVM); } //does nothing + void Release() override { sq_delete_refcounted(this,SQVM); } //does nothing //////////////////////////////////////////////////////////////////////////// //stack functions for the api void Remove(SQInteger n); diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp index b6750ac19c..753f3df9f0 100644 --- a/src/ai/ai_gui.cpp +++ b/src/ai/ai_gui.cpp @@ -118,7 +118,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: @@ -180,7 +180,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; @@ -266,7 +266,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.h b/src/aircraft.h index 5e1f32899b..16ca6fa029 100644 --- a/src/aircraft.h +++ b/src/aircraft.h @@ -91,30 +91,30 @@ struct Aircraft FINAL : public SpecializedVehicle { /** We want to 'destruct' the right class. */ virtual ~Aircraft() { this->PreDestructor(); } - void MarkDirty(); - void UpdateDeltaXY(); - ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; } - bool IsPrimaryVehicle() const { return this->IsNormalAircraft(); } - void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const; + void MarkDirty() override; + void UpdateDeltaXY() override; + ExpensesType GetExpenseType(bool income) const override { return income ? EXPENSES_AIRCRAFT_REVENUE : EXPENSES_AIRCRAFT_RUN; } + bool IsPrimaryVehicle() const override { return this->IsNormalAircraft(); } + void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const override; Direction GetMapImageDirection() const { return this->First()->direction; } - int GetDisplaySpeed() const { return this->cur_speed; } - int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; } - int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; } - int GetCurrentMaxSpeed() const { return this->GetSpeedOldUnits(); } - Money GetRunningCost() const; + int GetDisplaySpeed() const override { return this->cur_speed; } + int GetDisplayMaxSpeed() const override { return this->vcache.cached_max_speed; } + int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; } + int GetCurrentMaxSpeed() const override { return this->GetSpeedOldUnits(); } + Money GetRunningCost() const override; - bool IsInDepot() const + bool IsInDepot() const override { assert(this->IsPrimaryVehicle()); return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); } - bool Tick(); - void OnNewDay(); - void OnPeriodic(); - uint Crash(bool flooded = false); - TileIndex GetOrderStationLocation(StationID station); - ClosestDepot FindClosestDepot(); + bool Tick() override; + void OnNewDay() override; + void OnPeriodic() override; + uint Crash(bool flooded = false) override; + TileIndex GetOrderStationLocation(StationID station) override; + ClosestDepot FindClosestDepot() override; /** * Check if the aircraft type is a normal flying device; eg diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 91f7cb83ef..f64ae074ae 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1379,7 +1379,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) { @@ -1713,31 +1713,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 *) { error("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(); @@ -1791,7 +1791,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 @@ -1804,7 +1804,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 63e39729a9..8f0220790e 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -75,7 +75,7 @@ struct BuildAirToolbarWindow : Window { this->InitNested(window_number); this->OnInvalidateData(); if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_AT; } void Close() override @@ -90,14 +90,12 @@ 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; bool can_build = CanBuildVehicleInfrastructure(VEH_AIRCRAFT); - this->SetWidgetsDisabledState(!can_build, - WID_AT_AIRPORT, - WIDGET_LIST_END); + this->SetWidgetDisabledState(WID_AT_AIRPORT, !can_build); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR); @@ -108,7 +106,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: @@ -128,7 +126,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: @@ -143,12 +141,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); @@ -310,7 +308,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: { @@ -481,7 +479,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: @@ -538,13 +536,14 @@ public: } if (change_class) { /* If that fails, select the first available airport - * from a random class. */ + * from the first class where airports are available. */ for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) { AirportClass *apclass = AirportClass::Get(j); for (uint i = 0; i < apclass->GetSpecCount(); i++) { const AirportSpec *as = apclass->GetSpec(i); if (as->IsAvailable()) { _selected_airport_class = j; + this->vscroll->SetCount(apclass->GetSpecCount()); this->SelectOtherAirport(i); return; } @@ -557,13 +556,14 @@ public: void OnDropdownSelect(int widget, int index) override { - assert(widget == WID_AP_CLASS_DROPDOWN); - _selected_airport_class = (AirportClassID)index; - this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount()); - this->SelectFirstAvailableAirport(false); + if (widget == WID_AP_CLASS_DROPDOWN) { + _selected_airport_class = (AirportClassID)index; + this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount()); + this->SelectFirstAvailableAirport(false); + } } - void OnRealtimeTick(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 43ce628bbe..a1618b283f 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -301,7 +301,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: { @@ -540,7 +540,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: @@ -714,7 +714,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; @@ -738,7 +738,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 f372b26021..e23ac3f06f 100644 --- a/src/base_media_func.h +++ b/src/base_media_func.h @@ -152,7 +152,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 %s for base " SET_TYPE " set", filename.c_str()); diff --git a/src/bitmap_type.h b/src/bitmap_type.h index c66de23021..3281e141d8 100644 --- a/src/bitmap_type.h +++ b/src/bitmap_type.h @@ -123,7 +123,7 @@ public: if (!this->bitmap->HasTile(TileIndex(this->tile))) ++(*this); } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { (*this).OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !this->bitmap->HasTile(TileIndex(this->tile))) { @@ -132,7 +132,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 75c64d69cd..c6be9f3240 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -180,7 +180,7 @@ size_t Blitter_32bppBase::BufferSize(uint width, uint height) return sizeof(uint32) * 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/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index f7aeeb8fdf..4a3424e92f 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -169,7 +169,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/bootstrap_gui.cpp b/src/bootstrap_gui.cpp index 60c42e5f8a..2d0c5e1254 100644 --- a/src/bootstrap_gui.cpp +++ b/src/bootstrap_gui.cpp @@ -55,7 +55,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); @@ -97,7 +97,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); @@ -113,7 +113,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; @@ -158,7 +158,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(); @@ -213,7 +213,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) { @@ -238,12 +238,12 @@ public: void DrawWidget(const Rect &r, int widget) const override { - if (widget != 0) return; + if (widget != WID_BAFD_QUESTION) return; DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.frametext), STR_MISSING_GRAPHICS_SET_MESSAGE, TC_FROMSTRING, SA_CENTER); } - 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: @@ -333,7 +333,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) { @@ -345,7 +345,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 79ccb9ca0c..2655bf5e07 100644 --- a/src/bridge_gui.cpp +++ b/src/bridge_gui.cpp @@ -189,7 +189,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 { switch (widget) { case WID_BBS_DROPDOWN_ORDER: { @@ -270,7 +270,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 53fd08c1c1..565703aca4 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1569,7 +1569,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { void SelectEngine(EngineID engine) { CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; - if (cargo == CF_ANY) cargo = CF_NONE; + if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID; this->sel_engine = engine; this->SetBuyVehicleText(); @@ -1853,7 +1853,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { 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: @@ -1930,7 +1930,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { cmd = GetCmdBuildVeh(this->vehicle_type); } CargoID cargo = this->cargo_filter[this->cargo_filter_criteria]; - if (cargo == CF_ANY || cargo == CF_ENGINES) cargo = CF_NONE; + if (cargo == CF_ANY || cargo == CF_ENGINES || cargo == CF_NONE) cargo = CT_INVALID; DoCommandP(this->window_number, sel_eng | (cargo << 24), 0, cmd, callback); /* Update last used variant and refresh if necessary. */ @@ -1968,7 +1968,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { * @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. */ @@ -2016,7 +2016,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { } } - 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: @@ -2080,7 +2080,7 @@ struct BuildVehicleWindow : BuildVehicleWindowBase { this->GenerateBuildList(); this->vscroll->SetCount(this->eng_list.size()); - this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WIDGET_LIST_END); + this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD); /* Disable renaming engines in network games if you are not the server. */ this->SetWidgetDisabledState(WID_BV_RENAME, this->sel_engine == INVALID_ENGINE || (_networking && !_network_server)); diff --git a/src/cargotype.cpp b/src/cargotype.cpp index e646490ddc..a89de28162 100644 --- a/src/cargotype.cpp +++ b/src/cargotype.cpp @@ -41,41 +41,33 @@ void SetupCargoForClimate(LandscapeID l) { assert(l < lengthof(_default_climate_cargo)); - /* Reset and disable all cargo types */ - for (CargoID i = 0; i < lengthof(CargoSpec::array); i++) { - *CargoSpec::Get(i) = {}; - CargoSpec::Get(i)->bitnum = INVALID_CARGO; - - /* Set defaults for newer properties, which old GRFs do not know */ - CargoSpec::Get(i)->multiplier = 0x100; - } - _cargo_mask = 0; - for (CargoID i = 0; i < lengthof(_default_climate_cargo[l]); i++) { - CargoLabel cl = _default_climate_cargo[l][i]; + /* Copy from default cargo by label or index. */ + auto insert = std::begin(CargoSpec::array); + for (const CargoLabel &cl : _default_climate_cargo[l]) { - /* Bzzt: check if cl is just an index into the cargo table */ + /* Check if value is an index into the cargo table */ if (cl < lengthof(_default_cargo)) { - /* Copy the indexed cargo */ - CargoSpec *cargo = CargoSpec::Get(i); - *cargo = _default_cargo[cl]; - if (cargo->bitnum != INVALID_CARGO) SetBit(_cargo_mask, i); - continue; - } - - /* Loop through each of the default cargo types to see if - * the label matches */ - for (uint j = 0; j < lengthof(_default_cargo); j++) { - if (_default_cargo[j].label == cl) { - *CargoSpec::Get(i) = _default_cargo[j]; - - /* Populate the available cargo mask */ - SetBit(_cargo_mask, i); - break; + /* Copy the default cargo by index. */ + *insert = _default_cargo[cl]; + } else { + /* Search for label in default cargo types and copy if found. */ + auto found = std::find_if(std::begin(_default_cargo), std::end(_default_cargo), [&cl](const CargoSpec &cs) { return cs.label == cl; }); + if (found != std::end(_default_cargo)) { + *insert = *found; + } else { + /* Index or label is invalid, this should not happen. */ + NOT_REACHED(); } } + + if (insert->IsValid()) SetBit(_cargo_mask, insert->Index()); + ++insert; } + + /* Reset and disable remaining cargo types. */ + std::fill(insert, std::end(CargoSpec::array), CargoSpec{}); } /** @@ -123,7 +115,7 @@ CargoID GetCargoIDByLabel(CargoLabel cl) */ CargoID GetCargoIDByBitnum(uint8 bitnum) { - if (bitnum == INVALID_CARGO) return CT_INVALID; + if (bitnum == INVALID_CARGO_BITNUM) return CT_INVALID; for (const CargoSpec *cs : CargoSpec::Iterate()) { if (cs->bitnum == bitnum) return cs->Index(); @@ -150,6 +142,7 @@ SpriteID CargoSpec::GetCargoIcon() const return sprite; } +std::array _sorted_cargo_types; ///< Sort order of cargoes by cargo ID. std::vector _sorted_cargo_specs; ///< Cargo specifications sorted alphabetically by name. span _sorted_standard_cargo_specs; ///< Standard cargo specifications sorted alphabetically by name. @@ -194,6 +187,11 @@ void InitializeSortedCargoSpecs() /* Sort cargo specifications by cargo class and name. */ std::sort(_sorted_cargo_specs.begin(), _sorted_cargo_specs.end(), &CargoSpecClassSorter); + /* Populate */ + for (auto it = std::begin(_sorted_cargo_specs); it != std::end(_sorted_cargo_specs); ++it) { + _sorted_cargo_types[(*it)->Index()] = static_cast(it - std::begin(_sorted_cargo_specs)); + } + /* Count the number of standard cargos and fill the mask. */ _standard_cargo_mask = 0; uint8 nb_standard_cargo = 0; diff --git a/src/cargotype.h b/src/cargotype.h index 6346ebe61f..f62bd07f0f 100644 --- a/src/cargotype.h +++ b/src/cargotype.h @@ -51,16 +51,17 @@ enum CargoClass { CC_SPECIAL = 1 << 15, ///< Special bit used for livery refit tricks instead of normal cargoes. }; -static const byte INVALID_CARGO = 0xFF; ///< Constant representing invalid cargo +static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo /** Specification of a cargo type. */ struct CargoSpec { - uint8 bitnum; ///< Cargo bit number, is #INVALID_CARGO for a non-used spec. CargoLabel label; ///< Unique label of the cargo type. + uint8 bitnum{INVALID_CARGO_BITNUM}; ///< Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. uint8 legend_colour; uint8 rating_colour; uint8 weight; ///< Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). - uint16 multiplier; ///< Capacity multiplier for vehicles. (8 fractional bits) + uint16 multiplier{0x100}; ///< Capacity multiplier for vehicles. (8 fractional bits) + uint16 classes; ///< Classes of this cargo type. @see CargoClass int32 initial_payment; ///< Initial payment rate before inflation is applied. uint8 transit_periods[2]; @@ -76,7 +77,6 @@ struct CargoSpec { SpriteID sprite; ///< Icon to display this cargo type, may be \c 0xFFF (which means to resolve an action123 chain). - uint16 classes; ///< Classes of this cargo type. @see CargoClass const struct GRFFile *grffile; ///< NewGRF where #group belongs to. const struct SpriteGroup *group; @@ -107,7 +107,7 @@ struct CargoSpec { */ inline bool IsValid() const { - return this->bitnum != INVALID_CARGO; + return this->bitnum != INVALID_CARGO_BITNUM; } /** @@ -197,6 +197,7 @@ CargoID GetCargoIDByBitnum(uint8 bitnum); CargoID GetDefaultCargoID(LandscapeID l, CargoType ct); void InitializeSortedCargoSpecs(); +extern std::array _sorted_cargo_types; extern std::vector _sorted_cargo_specs; extern span _sorted_standard_cargo_specs; diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp index b952277e44..aaf9f0bd2d 100644 --- a/src/cheat_gui.cpp +++ b/src/cheat_gui.cpp @@ -327,7 +327,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; @@ -380,8 +380,10 @@ struct CheatWindow : Window { size->height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lines; } - 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_C_PANEL) return; + Rect r = this->GetWidget(WID_C_PANEL)->GetCurrentRect().Shrink(WidgetDimensions::scaled.framerect); uint btn = (pt.y - r.top) / this->line_height; uint x = pt.x - r.left; diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 2035b9d5d5..2d43c59a33 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -197,7 +197,7 @@ static void DrawTile_Clear(TileInfo *ti, DrawTileProcParams params) 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); @@ -205,7 +205,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; } @@ -426,7 +426,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; } @@ -450,12 +450,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 DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); } diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 39d4f5c7be..c6eefd97b3 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -398,7 +398,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: @@ -494,7 +494,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 @@ -643,7 +643,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); } @@ -653,7 +653,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); @@ -830,7 +830,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: { @@ -1001,7 +1001,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 */ @@ -1106,7 +1106,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; @@ -1127,7 +1127,7 @@ public: return; } - this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT); bool current_class_valid = this->livery_class == LC_OTHER || this->livery_class >= LC_GROUP_RAIL; if (_settings_client.gui.liveries == LIT_ALL || (_settings_client.gui.liveries == LIT_COMPANY && this->window_number == _local_company)) { @@ -1495,7 +1495,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: @@ -1543,8 +1543,8 @@ public: void OnPaint() override { /* lower the non-selected gender button */ - this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END); - this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2, WIDGET_LIST_END); + this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2); + this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2); /* advanced company manager face selection window */ @@ -1559,44 +1559,44 @@ public: /* Eye colour buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2, - WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R, WIDGET_LIST_END); + WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R); /* Chin buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2, - WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R, WIDGET_LIST_END); + WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R); /* Eyebrows buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2, - WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R, WIDGET_LIST_END); + WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R); /* Lips or (if it a male face with a moustache) moustache buttons */ this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2, - WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R, WIDGET_LIST_END); + WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R); /* Nose buttons | male faces with moustache haven't any nose options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male, - WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R, WIDGET_LIST_END); + WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R); /* Hair buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2, - WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R, WIDGET_LIST_END); + WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R); /* Jacket buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2, - WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R, WIDGET_LIST_END); + WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R); /* Collar buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2, - WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R, WIDGET_LIST_END); + WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R); /* Tie/earring buttons | female faces without earring haven't any earring options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 || (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0), - WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R, WIDGET_LIST_END); + WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R); /* Glasses buttons | faces without glasses haven't any glasses options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0, - WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R, WIDGET_LIST_END); + WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R); this->DrawWidgets(); } @@ -1671,7 +1671,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 */ @@ -1926,7 +1926,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); @@ -2192,7 +2192,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; @@ -2462,7 +2462,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: { @@ -2675,7 +2675,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; @@ -2780,7 +2780,7 @@ struct CompanyWindow : Window this->SetDirty(); } - void OnPlaceObject(Point pt, TileIndex tile) override + void OnPlaceObject([[maybe_unused]] Point pt, TileIndex tile) override { if (DoCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS)) && !_shift_pressed) { ResetObjectToPlace(); @@ -2949,7 +2949,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 3c947e05b4..b8481af03f 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 2f735af7ce..654e407ce0 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -107,7 +107,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) /**************** @@ -2105,17 +2105,17 @@ static ContentType StringToContentType(const char *str) /** Asynchronous callback */ struct ConsoleContentCallback : public ContentCallback { - void OnConnect(bool success) + void OnConnect(bool success) override { IConsolePrintF(CC_DEFAULT, "Content server connection %s", success ? "established" : "failed"); } - void OnDisconnect() + void OnDisconnect() override { IConsolePrintF(CC_DEFAULT, "Content server connection closed"); } - void OnDownloadComplete(ContentID cid) + void OnDownloadComplete(ContentID cid) override { IConsolePrintF(CC_DEFAULT, "Completed download of %d", cid); } diff --git a/src/console_gui.cpp b/src/console_gui.cpp index 89d3fc3a3b..9b6a1edf94 100644 --- a/src/console_gui.cpp +++ b/src/console_gui.cpp @@ -281,7 +281,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; diff --git a/src/core/pool_type.hpp b/src/core/pool_type.hpp index 80e5ececed..df954dcdcf 100644 --- a/src/core/pool_type.hpp +++ b/src/core/pool_type.hpp @@ -99,7 +99,7 @@ struct Pool : PoolBase { uint64 *free_bitmap; ///< Pointer to free bitmap Pool(const char *name); - virtual void CleanPool(); + void CleanPool() override; /** * Returns Titem with given index @@ -277,13 +277,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. @@ -377,7 +376,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) { } /** * Dummy function called before a pool is about to be cleaned. diff --git a/src/cpu.cpp b/src/cpu.cpp index 12cbfd0f82..120c813012 100644 --- a/src/cpu.cpp +++ b/src/cpu.cpp @@ -166,7 +166,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 5416da2769..35806d393c 100644 --- a/src/date_gui.cpp +++ b/src/date_gui.cpp @@ -105,7 +105,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) { @@ -143,7 +143,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: @@ -195,7 +195,7 @@ struct SetMinutesWindow : SetDateWindow * Helper function to construct the dropdown. * @param widget the dropdown widget to create the dropdown for */ - virtual void ShowDateDropDown(int widget) + virtual void ShowDateDropDown(int widget) override { int selected; DropDownList list; @@ -224,7 +224,7 @@ struct SetMinutesWindow : SetDateWindow ShowDropDownList(this, std::move(list), selected, widget); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { Dimension d = {0, 0}; switch (widget) { @@ -250,7 +250,7 @@ struct SetMinutesWindow : SetDateWindow *size = d; } - virtual void SetStringParameters(int widget) const + virtual void SetStringParameters(int widget) const override { switch (widget) { case WID_SD_DAY: SetDParam(0, MINUTES_MINUTE(minutes)); break; @@ -258,7 +258,7 @@ struct SetMinutesWindow : SetDateWindow } } - virtual void OnClick(Point pt, int widget, int click_count) + virtual void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case WID_SD_DAY: @@ -276,7 +276,7 @@ struct SetMinutesWindow : SetDateWindow } } - virtual void OnDropdownSelect(int widget, int index) + virtual void OnDropdownSelect(int widget, int index) override { Minutes current = 0; switch (widget) { diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index c9c3eab5ac..6e744c9978 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -657,7 +657,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: { @@ -705,7 +705,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; } @@ -756,13 +756,12 @@ struct DepotWindow : Window { WID_D_BUILD, WID_D_CLONE, WID_D_RENAME, - WID_D_AUTOREPLACE, - WIDGET_LIST_END); + WID_D_AUTOREPLACE); 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 @@ -844,7 +843,7 @@ struct DepotWindow : Window { DoCommandP(0, this->GetDepotIndex(), 0, CMD_RENAME_DEPOT | CMD_MSG(STR_ERROR_CAN_T_RENAME_DEPOT), nullptr, 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 118b998346..69b7a58e88 100644 --- a/src/disaster_vehicle.cpp +++ b/src/disaster_vehicle.cpp @@ -714,7 +714,7 @@ static bool DisasterTick_Submarine(DisasterVehicle *v) } -static bool DisasterTick_NULL(DisasterVehicle *v) +static bool DisasterTick_NULL(DisasterVehicle *) { return true; } diff --git a/src/disaster_vehicle.h b/src/disaster_vehicle.h index c1aab13588..35bced0bda 100644 --- a/src/disaster_vehicle.h +++ b/src/disaster_vehicle.h @@ -47,9 +47,9 @@ struct DisasterVehicle FINAL : public SpecializedVehicleSetWidgetsDisabledState(!can_build, WID_DT_DEPOT, WID_DT_STATION, - WID_DT_BUOY, - WIDGET_LIST_END); + WID_DT_BUOY); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER); CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); @@ -147,7 +146,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 @@ -188,7 +187,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 @@ -237,12 +236,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) { @@ -273,7 +272,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; @@ -458,7 +457,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: @@ -473,7 +472,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -526,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: @@ -560,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/economy.cpp b/src/economy.cpp index 43418fb351..de1c5e03f6 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1396,9 +1396,10 @@ static void TriggerIndustryProduction(Industry *i) } else { for (uint ci_in = 0; ci_in < lengthof(i->incoming_cargo_waiting); ci_in++) { uint cargo_waiting = i->incoming_cargo_waiting[ci_in]; - if (cargo_waiting == 0) continue; + if (cargo_waiting == 0 || i->accepts_cargo[ci_in] == CT_INVALID) continue; for (uint ci_out = 0; ci_out < lengthof(i->produced_cargo_waiting); ci_out++) { + if (i->produced_cargo[ci_out] == CT_INVALID) continue; i->produced_cargo_waiting[ci_out] = ClampTo(i->produced_cargo_waiting[ci_out] + (cargo_waiting * indspec->input_cargo_multiplier[ci_in][ci_out] / 256)); } diff --git a/src/effectvehicle_base.h b/src/effectvehicle_base.h index b26be6723a..bb0617faa2 100644 --- a/src/effectvehicle_base.h +++ b/src/effectvehicle_base.h @@ -30,8 +30,8 @@ struct EffectVehicle FINAL : public SpecializedVehicleRemoveEffectVehicleFromTickCache(); } - void UpdateDeltaXY(); - bool Tick(); + void UpdateDeltaXY() override; + bool Tick() override; TransparencyOption GetTransparencyOption() const; void AddEffectVehicleToTickCache(); void RemoveEffectVehicleFromTickCache(); diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp index 3c1ae60af9..49c5e4e61f 100644 --- a/src/engine_gui.cpp +++ b/src/engine_gui.cpp @@ -76,7 +76,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; @@ -121,7 +121,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: @@ -133,7 +133,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 d5893a4fd0..863cee63ef 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -177,7 +177,7 @@ public: this->InitNested(); } - 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: { @@ -241,7 +241,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/fios.cpp b/src/fios.cpp index 32556ae547..a59d694b7f 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -280,10 +280,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; @@ -660,7 +659,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; diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index 835382bfed..4ce2dd7ffc 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -291,13 +291,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; @@ -587,7 +587,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: @@ -620,7 +620,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 @@ -742,7 +742,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); diff --git a/src/fontcache.cpp b/src/fontcache.cpp index 0168cd4345..8f426a7700 100644 --- a/src/fontcache.cpp +++ b/src/fontcache.cpp @@ -187,5 +187,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 0ed8ab1e26..b8887b4078 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 ce74972b3e..80f127852a 100644 --- a/src/fontcache/spritefontcache.h +++ b/src/fontcache/spritefontcache.h @@ -23,16 +23,16 @@ private: public: SpriteFontCache(FontSize fs); ~SpriteFontCache(); - virtual void SetUnicodeGlyph(WChar key, SpriteID sprite); - virtual void InitializeUnicodeGlyphMap(); - virtual void ClearFontCache(); - virtual const Sprite *GetGlyph(GlyphID key); - virtual uint GetGlyphWidth(GlyphID key); - virtual bool GetDrawGlyphShadow(); - virtual GlyphID MapCharToGlyph(WChar key) { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } - virtual const void *GetFontTable(uint32 tag, size_t &length) { length = 0; return nullptr; } - virtual std::string GetFontName() { return "sprite"; } - virtual bool IsBuiltInFont() { return true; } + void SetUnicodeGlyph(char32_t key, SpriteID sprite) override; + void InitializeUnicodeGlyphMap() override; + void ClearFontCache() override; + const Sprite *GetGlyph(GlyphID key) override; + uint GetGlyphWidth(GlyphID key) override; + bool GetDrawGlyphShadow() override; + GlyphID MapCharToGlyph(char32_t key) override { assert(IsPrintable(key)); return SPRITE_GLYPH | key; } + const void *GetFontTable(uint32_t, size_t &length) override { length = 0; return nullptr; } + std::string GetFontName() override { return "sprite"; } + bool IsBuiltInFont() override { return true; } }; #endif /* SPRITEFONTCACHE_H */ diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp index 9e39aeb76c..b825c2507a 100644 --- a/src/framerate_gui.cpp +++ b/src/framerate_gui.cpp @@ -456,7 +456,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 { bool elapsed = this->next_update.Elapsed(delta_ms); @@ -538,7 +538,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: @@ -691,7 +691,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: @@ -779,7 +779,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); diff --git a/src/game/game_gui.cpp b/src/game/game_gui.cpp index 2fda48e833..e5fadcdc29 100644 --- a/src/game/game_gui.cpp +++ b/src/game/game_gui.cpp @@ -137,7 +137,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: @@ -245,7 +245,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; @@ -321,7 +321,7 @@ struct GSConfigWindow : public Window { list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_GSC_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -374,12 +374,14 @@ struct GSConfigWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget != WID_GSC_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); SetValue(index); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { + if (widget != WID_GSC_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is @@ -407,7 +409,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 3b4e3d7fa5..5f44ff3ea0 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -143,22 +143,22 @@ struct TranslationWriter : LanguageWriter { { } - void WriteHeader(const LanguagePackHeader *header) + void WriteHeader(const LanguagePackHeader *) override { /* We don't use the header. */ } - void Finalise() + void Finalise() override { /* Nothing to do. */ } - void WriteLength(uint length) + void WriteLength(uint) override { /* We don't write the length. */ } - void Write(const byte *buffer, size_t length) + void Write(const byte *buffer, size_t length) override { this->strings.emplace_back((const char *)buffer, length); } @@ -176,12 +176,12 @@ struct StringNameWriter : HeaderWriter { { } - void WriteStringID(const char *name, int stringid) + void WriteStringID(const char *name, int stringid) override { if (stringid == (int)this->strings.size()) this->strings.emplace_back(name); } - void Finalise(const StringData &data) + void Finalise(const StringData &) override { /* Nothing to do. */ } @@ -207,7 +207,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/genworld_gui.cpp b/src/genworld_gui.cpp index 0b8541ba68..bbe648002e 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -580,7 +580,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 */ @@ -595,7 +595,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == LG_ORIGINAL); this->SetWidgetDisabledState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM, - WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END); + WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW); this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); @@ -605,7 +605,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC), - WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END); + WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN); } /* Disable snowline if not arctic */ @@ -655,7 +655,7 @@ struct GenerateLandscapeWindow : public Window { this->SetDirty(); } - 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; @@ -758,7 +758,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: @@ -998,16 +998,13 @@ struct GenerateLandscapeWindow : public Window { void OnTimeout() override { - static const int newgame_raise_widgets[] = {WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WID_GL_RAINFOREST_LEVEL_UP, WID_GL_RAINFOREST_LEVEL_DOWN, WIDGET_LIST_END}; - static const int heightmap_raise_widgets[] = {WID_GL_HEIGHTMAP_HEIGHT_DOWN, WID_GL_HEIGHTMAP_HEIGHT_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WID_GL_RAINFOREST_LEVEL_UP, WID_GL_RAINFOREST_LEVEL_DOWN, WIDGET_LIST_END}; - - const int *widget = (mode == GLWM_HEIGHTMAP) ? heightmap_raise_widgets : newgame_raise_widgets; - - for (; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } + if (mode == GLWM_HEIGHTMAP) { + this->RaiseWidgetsWhenLowered(WID_GL_HEIGHTMAP_HEIGHT_DOWN, WID_GL_HEIGHTMAP_HEIGHT_UP, WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, + WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, WID_GL_DESERT_COVERAGE_DOWN, WID_GL_SNOW_LEVEL_UP, + WID_GL_SNOW_LEVEL_DOWN, WID_GL_RAINFOREST_LEVEL_UP, WID_GL_RAINFOREST_LEVEL_DOWN); + } else { + this->RaiseWidgetsWhenLowered(WID_GL_START_DATE_DOWN, WID_GL_START_DATE_UP, WID_GL_SNOW_COVERAGE_UP, WID_GL_SNOW_COVERAGE_DOWN, WID_GL_DESERT_COVERAGE_UP, + WID_GL_DESERT_COVERAGE_DOWN, WID_GL_SNOW_LEVEL_UP, WID_GL_SNOW_LEVEL_DOWN, WID_GL_RAINFOREST_LEVEL_UP, WID_GL_RAINFOREST_LEVEL_DOWN); } } @@ -1279,7 +1276,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) { @@ -1306,7 +1303,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: @@ -1375,13 +1372,7 @@ struct CreateScenarioWindow : public Window void OnTimeout() override { - static const int raise_widgets[] = {WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP, WIDGET_LIST_END}; - for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } - } + this->RaiseWidgetsWhenLowered(WID_CS_START_DATE_DOWN, WID_CS_START_DATE_UP, WID_CS_FLAT_LAND_HEIGHT_DOWN, WID_CS_FLAT_LAND_HEIGHT_UP); } void OnDropdownSelect(int widget, int index) override @@ -1530,7 +1521,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(); @@ -1546,7 +1537,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: @@ -1561,7 +1552,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 8656c4ae7d..c4c510bbc1 100644 --- a/src/gfx_layout_fallback.cpp +++ b/src/gfx_layout_fallback.cpp @@ -96,8 +96,9 @@ public: * @param c The character to add. * @return The number of buffer spaces that were used. */ -/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(WChar *buff, const WChar *buffer_last, WChar c) +/* static */ size_t FallbackParagraphLayoutFactory::AppendToBuffer(char32_t *buff, [[maybe_unused]] const char32_t *buffer_last, char32_t c) { + assert(buff < buffer_last); *buff = c; return 1; } diff --git a/src/gfx_layout_icu.cpp b/src/gfx_layout_icu.cpp index b2adf92267..8c3bf288bb 100644 --- a/src/gfx_layout_icu.cpp +++ b/src/gfx_layout_icu.cpp @@ -340,13 +340,11 @@ std::vector ItemizeScript(UChar *buff, size_t length, std::vector ItemizeStyle(UChar *buff, size_t length, std::vector &runs_current, FontMap &font_mapping) +std::vector ItemizeStyle(std::vector &runs_current, FontMap &font_mapping) { std::vector runs; @@ -380,7 +378,7 @@ std::vector ItemizeStyle(UChar *buff, size_t length, std::vector auto runs = ItemizeBidi(buff, length); runs = ItemizeScript(buff, length, runs); - runs = ItemizeStyle(buff, length, runs, font_mapping); + runs = ItemizeStyle(runs, font_mapping); if (runs.size() == 0) return nullptr; @@ -524,6 +522,7 @@ std::unique_ptr ICUParagraphLayout::NextLine(int /* static */ size_t ICUParagraphLayoutFactory::AppendToBuffer(UChar *buff, const UChar *buffer_last, WChar c) { + assert(buff < buffer_last); /* Transform from UTF-32 to internal ICU format of UTF-16. */ int32 length = 0; UErrorCode err = U_ZERO_ERROR; diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index 91879fcb8b..89462a8534 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 e6511c1fc3..eba2f99898 100644 --- a/src/graph_gui.cpp +++ b/src/graph_gui.cpp @@ -79,7 +79,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; @@ -98,7 +98,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; @@ -514,7 +514,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; @@ -557,12 +557,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(); @@ -578,7 +578,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); @@ -1061,7 +1061,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); @@ -1267,7 +1267,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); @@ -1326,7 +1326,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: @@ -1386,7 +1386,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->SetXAxis(); @@ -1533,7 +1533,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: @@ -1670,7 +1670,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)) { @@ -1698,7 +1698,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 7d7f553645..1c2e726e56 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -424,9 +424,6 @@ public: this->group_rename = INVALID_GROUP; this->group_over = INVALID_GROUP; - this->BuildVehicleList(); - this->SortVehicleList(); - this->groups.ForceRebuild(); this->groups.NeedResort(); this->BuildGroupList(vli.company); @@ -445,6 +442,9 @@ public: this->FinishInitNested(window_number); this->owner = vli.company; + + this->BuildVehicleList(); + this->SortVehicleList(); } void Close() override @@ -453,7 +453,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 { switch (widget) { case WID_GL_LIST_GROUP: @@ -511,7 +511,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 */ @@ -593,16 +593,14 @@ public: this->SetWidgetDisabledState(WID_GL_MANAGE_VEHICLES_DROPDOWN, !this->ShouldShowActionDropdownList() || _local_company != this->vli.company); this->SetWidgetsDisabledState(this->vehicles.size() == 0 || _local_company != this->vli.company || (IsTopLevelGroupID(this->vli.index) && _settings_client.gui.disable_top_veh_list_mass_actions), WID_GL_STOP_ALL, - WID_GL_START_ALL, - WIDGET_LIST_END); + WID_GL_START_ALL); /* Disable the group specific function when we select the default group or all vehicles */ this->SetWidgetsDisabledState(IsDefaultGroupID(this->vli.index) || IsAllGroupID(this->vli.index) || _local_company != this->vli.company, WID_GL_DELETE_GROUP, WID_GL_RENAME_GROUP, WID_GL_LIVERY_GROUP, - WID_GL_REPLACE_PROTECTION, - WIDGET_LIST_END); + WID_GL_REPLACE_PROTECTION); /* Disable remaining buttons for non-local companies * Needed while changing _local_company, eg. by cheats @@ -612,8 +610,7 @@ public: */ this->SetWidgetsDisabledState(_local_company != this->vli.company, WID_GL_CREATE_GROUP, - WID_GL_AVAILABLE_VEHICLES, - WIDGET_LIST_END); + WID_GL_AVAILABLE_VEHICLES); /* If not a default group and the group has replace protection, show an enabled replace sprite. */ uint16 protect_sprite = SPR_GROUP_REPLACE_OFF_TRAIN; @@ -716,7 +713,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 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 820b4618bd..a157a6f47a 100644 --- a/src/highscore_gui.cpp +++ b/src/highscore_gui.cpp @@ -62,7 +62,7 @@ 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(); } diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index df6d52acdd..2f85c50106 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, DrawTileProcParams params) } } -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); } @@ -993,7 +993,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; } @@ -1140,10 +1140,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 */ @@ -1168,6 +1167,9 @@ static bool SearchLumberMillTrees(TileIndex tile, void *user_data) */ static void ChopLumberMillTrees(Industry *i) { + /* Skip production if cargo slot is invalid. */ + if (i->produced_cargo[0] == CT_INVALID) return; + /* We only want to cut trees if all tiles are completed. */ for (TileIndex tile_cur : i->location) { if (i->TileBelongsToIndustry(tile_cur)) { @@ -1184,6 +1186,7 @@ static void ChopLumberMillTrees(Industry *i) static void ProduceIndustryGoodsFromRate(Industry *i, bool scale) { for (size_t j = 0; j < lengthof(i->produced_cargo_waiting); j++) { + if (i->produced_cargo[j] == CT_INVALID) continue; uint amount = i->production_rate[j]; if (amount != 0 && scale) { amount = ScaleQuantity(amount, _settings_game.economy.industry_cargo_scale_factor); @@ -1291,10 +1294,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(); } @@ -1660,7 +1662,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i * This function tries to flatten out the land below an industry, without * damaging the surroundings too much. */ -static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout, int type) +static bool CheckIfCanLevelIndustryPlatform(TileIndex tile, DoCommandFlag flags, const IndustryTileLayout &layout) { int max_x = 0; int max_y = 0; @@ -2074,7 +2076,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do if (ret.Failed()) return ret; if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && - !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout, type)) { + !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER, layout)) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -2082,7 +2084,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do if (flags & DC_EXEC) { *ip = new Industry(tile); - if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout, type); + if (!custom_shape_check) CheckIfCanLevelIndustryPlatform(tile, DC_NO_WATER | DC_EXEC, layout); DoCreateNewIndustry(*ip, tile, type, layout, layout_index, t, founder, random_initial_bits); } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 474e740fa9..596439c823 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -430,7 +430,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: { @@ -603,7 +603,7 @@ public: } } - static void AskManyRandomIndustriesCallback(Window *w, bool confirmed) + static void AskManyRandomIndustriesCallback(Window *, bool confirmed) { if (!confirmed) return; @@ -618,7 +618,7 @@ public: } } - static void AskRemoveAllIndustriesCallback(Window *w, bool confirmed) + static void AskRemoveAllIndustriesCallback(Window *, bool confirmed) { if (!confirmed) return; @@ -634,7 +634,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: { @@ -698,7 +698,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 */ @@ -760,7 +760,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(); @@ -992,12 +992,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: { @@ -1145,7 +1145,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); @@ -1622,7 +1622,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); @@ -1630,10 +1630,11 @@ public: this->industries.SetListing(this->last_sorting); this->industries.SetSortFuncs(IndustryDirectoryWindow::sorter_funcs); this->industries.ForceRebuild(); - this->BuildSortIndustriesList(); this->FinishInitNested(0); + this->BuildSortIndustriesList(); + this->querystrings[WID_ID_FILTER] = &this->industry_editbox; this->industry_editbox.cancel_button = QueryString::ACTION_CLEAR; } @@ -1700,7 +1701,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: { @@ -1738,7 +1739,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: @@ -1827,7 +1828,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: @@ -1931,6 +1932,11 @@ enum CargoesFieldType { static const uint MAX_CARGOES = 16; ///< Maximum number of cargoes carried in a #CFT_CARGO field in #CargoesField. +static bool CargoIDSorter(const CargoID &a, const CargoID &b) +{ + return _sorted_cargo_types[a] < _sorted_cargo_types[b]; +} + /** Data about a single field in the #IndustryCargoesWindow panel. */ struct CargoesField { static int vert_inter_industry_space; @@ -1958,15 +1964,15 @@ struct CargoesField { CargoID other_accepted[MAX_CARGOES]; ///< Cargoes accepted but not used in this figure. } industry; ///< Industry data (for #CFT_INDUSTRY). struct { - CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #INVALID_CARGO). - byte num_cargoes; ///< Number of cargoes. - CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #INVALID_CARGO). - byte top_end; ///< Stop at the top of the vertical cargoes. - CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #INVALID_CARGO). - byte bottom_end; ///< Stop at the bottom of the vertical cargoes. + CargoID vertical_cargoes[MAX_CARGOES]; ///< Cargoes running from top to bottom (cargo ID or #CT_INVALID). + uint8_t num_cargoes; ///< Number of cargoes. + CargoID supp_cargoes[MAX_CARGOES]; ///< Cargoes entering from the left (index in #vertical_cargoes, or #CT_INVALID). + uint8_t top_end; ///< Stop at the top of the vertical cargoes. + CargoID cust_cargoes[MAX_CARGOES]; ///< Cargoes leaving to the right (index in #vertical_cargoes, or #CT_INVALID). + uint8_t bottom_end; ///< Stop at the bottom of the vertical cargoes. } cargo; ///< Cargo data (for #CFT_CARGO). struct { - CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #INVALID_CARGO). + CargoID cargoes[MAX_CARGOES]; ///< Cargoes to display (or #CT_INVALID). bool left_align; ///< Align all cargo texts to the left (else align to the right). } cargo_label; ///< Label data (for #CFT_CARGO_LABEL). StringID header; ///< Header text (for #CFT_HEADER). @@ -1990,8 +1996,8 @@ struct CargoesField { { this->type = CFT_INDUSTRY; this->u.industry.ind_type = ind_type; - MemSetT(this->u.industry.other_accepted, INVALID_CARGO, MAX_CARGOES); - MemSetT(this->u.industry.other_produced, INVALID_CARGO, MAX_CARGOES); + std::fill(std::begin(this->u.industry.other_accepted), std::end(this->u.industry.other_accepted), CT_INVALID); + std::fill(std::begin(this->u.industry.other_produced), std::end(this->u.industry.other_produced), CT_INVALID); } /** @@ -2003,7 +2009,7 @@ struct CargoesField { int ConnectCargo(CargoID cargo, bool producer) { assert(this->type == CFT_CARGO); - if (cargo == INVALID_CARGO) return -1; + if (cargo == CT_INVALID) return -1; /* Find the vertical cargo column carrying the cargo. */ int column = -1; @@ -2016,10 +2022,10 @@ struct CargoesField { if (column < 0) return -1; if (producer) { - assert(this->u.cargo.supp_cargoes[column] == INVALID_CARGO); + assert(this->u.cargo.supp_cargoes[column] == CT_INVALID); this->u.cargo.supp_cargoes[column] = column; } else { - assert(this->u.cargo.cust_cargoes[column] == INVALID_CARGO); + assert(this->u.cargo.cust_cargoes[column] == CT_INVALID); this->u.cargo.cust_cargoes[column] = column; } return column; @@ -2034,15 +2040,15 @@ struct CargoesField { assert(this->type == CFT_CARGO); for (uint i = 0; i < MAX_CARGOES; i++) { - if (this->u.cargo.supp_cargoes[i] != INVALID_CARGO) return true; - if (this->u.cargo.cust_cargoes[i] != INVALID_CARGO) return true; + if (this->u.cargo.supp_cargoes[i] != CT_INVALID) return true; + if (this->u.cargo.cust_cargoes[i] != CT_INVALID) return true; } return false; } /** * Make a piece of cargo column. - * @param cargoes Array of #CargoID (may contain #INVALID_CARGO). + * @param cargoes Array of #CargoID (may contain #CT_INVALID). * @param length Number of cargoes in \a cargoes. * @param count Number of cargoes to display (should be at least the number of valid cargoes, or \c -1 to let the method compute it). * @param top_end This is the first cargo field of this column. @@ -2052,25 +2058,25 @@ struct CargoesField { void MakeCargo(const CargoID *cargoes, uint length, int count = -1, bool top_end = false, bool bottom_end = false) { this->type = CFT_CARGO; - uint i; - uint num = 0; - for (i = 0; i < MAX_CARGOES && i < length; i++) { - if (cargoes[i] != INVALID_CARGO) { - this->u.cargo.vertical_cargoes[num] = cargoes[i]; - num++; + auto insert = std::begin(this->u.cargo.vertical_cargoes); + for (uint i = 0; insert != std::end(this->u.cargo.vertical_cargoes) && i < length; i++) { + if (cargoes[i] != CT_INVALID) { + *insert = cargoes[i]; + ++insert; } } - this->u.cargo.num_cargoes = (count < 0) ? num : count; - for (; num < MAX_CARGOES; num++) this->u.cargo.vertical_cargoes[num] = INVALID_CARGO; + this->u.cargo.num_cargoes = (count < 0) ? static_cast(insert - std::begin(this->u.cargo.vertical_cargoes)) : count; + std::sort(std::begin(this->u.cargo.vertical_cargoes), insert, &CargoIDSorter); + std::fill(insert, std::end(this->u.cargo.vertical_cargoes), CT_INVALID); this->u.cargo.top_end = top_end; this->u.cargo.bottom_end = bottom_end; - MemSetT(this->u.cargo.supp_cargoes, INVALID_CARGO, MAX_CARGOES); - MemSetT(this->u.cargo.cust_cargoes, INVALID_CARGO, MAX_CARGOES); + std::fill(std::begin(this->u.cargo.supp_cargoes), std::end(this->u.cargo.supp_cargoes), CT_INVALID); + std::fill(std::begin(this->u.cargo.cust_cargoes), std::end(this->u.cargo.cust_cargoes), CT_INVALID); } /** * Make a field displaying cargo type names. - * @param cargoes Array of #CargoID (may contain #INVALID_CARGO). + * @param cargoes Array of #CargoID (may contain #CT_INVALID). * @param length Number of cargoes in \a cargoes. * @param left_align ALign texts to the left (else to the right). */ @@ -2079,7 +2085,7 @@ struct CargoesField { this->type = CFT_CARGO_LABEL; uint i; for (i = 0; i < MAX_CARGOES && i < length; i++) this->u.cargo_label.cargoes[i] = cargoes[i]; - for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = INVALID_CARGO; + for (; i < MAX_CARGOES; i++) this->u.cargo_label.cargoes[i] = CT_INVALID; this->u.cargo_label.left_align = left_align; } @@ -2162,13 +2168,13 @@ struct CargoesField { } ypos1 += CargoesField::cargo_border.height + (FONT_HEIGHT_NORMAL - CargoesField::cargo_line.height) / 2; for (uint i = 0; i < CargoesField::max_cargoes; i++) { - if (other_right[i] != INVALID_CARGO) { + if (other_right[i] != CT_INVALID) { const CargoSpec *csp = CargoSpec::Get(other_right[i]); int xp = xpos + industry_width + CargoesField::cargo_stub.width; DrawHorConnection(xpos + industry_width, xp - 1, ypos1, csp); GfxDrawLine(xp, ypos1, xp, ypos1 + CargoesField::cargo_line.height - 1, CARGO_LINE_COLOUR); } - if (other_left[i] != INVALID_CARGO) { + if (other_left[i] != CT_INVALID) { const CargoSpec *csp = CargoSpec::Get(other_left[i]); int xp = xpos - CargoesField::cargo_stub.width; DrawHorConnection(xp + 1, xpos - 1, ypos1, csp); @@ -2206,7 +2212,7 @@ struct CargoesField { } ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2 + (FONT_HEIGHT_NORMAL - CargoesField::cargo_line.height) / 2; for (uint i = 0; i < MAX_CARGOES; i++) { - if (hor_left[i] != INVALID_CARGO) { + if (hor_left[i] != CT_INVALID) { int col = hor_left[i]; int dx = 0; const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[col]); @@ -2217,7 +2223,7 @@ struct CargoesField { } DrawHorConnection(xpos, cargo_base - dx, ypos, csp); } - if (hor_right[i] != INVALID_CARGO) { + if (hor_right[i] != CT_INVALID) { int col = hor_right[i]; int dx = 0; const CargoSpec *csp = CargoSpec::Get(this->u.cargo.vertical_cargoes[col]); @@ -2236,7 +2242,7 @@ struct CargoesField { case CFT_CARGO_LABEL: ypos += CargoesField::cargo_border.height + vert_inter_industry_space / 2; for (uint i = 0; i < MAX_CARGOES; i++) { - if (this->u.cargo_label.cargoes[i] != INVALID_CARGO) { + if (this->u.cargo_label.cargoes[i] != CT_INVALID) { const CargoSpec *csp = CargoSpec::Get(this->u.cargo_label.cargoes[i]); DrawString(xpos + WidgetDimensions::scaled.framerect.left, xpos + industry_width - 1 - WidgetDimensions::scaled.framerect.right, ypos, csp->name, TC_WHITE, (this->u.cargo_label.left_align) ? SA_LEFT : SA_RIGHT); @@ -2255,7 +2261,7 @@ struct CargoesField { * @param left Left industry neighbour if available (else \c nullptr should be supplied). * @param right Right industry neighbour if available (else \c nullptr should be supplied). * @param pt Click position in the cargo field. - * @return Cargo clicked at, or #INVALID_CARGO if none. + * @return Cargo clicked at, or #CT_INVALID if none. */ CargoID CargoClickedAt(const CargoesField *left, const CargoesField *right, Point pt) const { @@ -2274,45 +2280,50 @@ struct CargoesField { int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.width; uint row; for (row = 0; row < MAX_CARGOES; row++) { - if (pt.y < vpos) return INVALID_CARGO; + if (pt.y < vpos) return CT_INVALID; if (pt.y < vpos + FONT_HEIGHT_NORMAL) break; vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.width; } - if (row == MAX_CARGOES) return INVALID_CARGO; + if (row == MAX_CARGOES) return CT_INVALID; /* row = 0 -> at first horizontal row, row = 1 -> second horizontal row, 2 = 3rd horizontal row. */ if (col == 0) { - if (this->u.cargo.supp_cargoes[row] != INVALID_CARGO) return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]]; + if (this->u.cargo.supp_cargoes[row] != CT_INVALID) return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]]; if (left != nullptr) { if (left->type == CFT_INDUSTRY) return left->u.industry.other_produced[row]; if (left->type == CFT_CARGO_LABEL && !left->u.cargo_label.left_align) return left->u.cargo_label.cargoes[row]; } - return INVALID_CARGO; + return CT_INVALID; } if (col == this->u.cargo.num_cargoes) { - if (this->u.cargo.cust_cargoes[row] != INVALID_CARGO) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; + if (this->u.cargo.cust_cargoes[row] != CT_INVALID) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; if (right != nullptr) { if (right->type == CFT_INDUSTRY) return right->u.industry.other_accepted[row]; if (right->type == CFT_CARGO_LABEL && right->u.cargo_label.left_align) return right->u.cargo_label.cargoes[row]; } - return INVALID_CARGO; + return CT_INVALID; } if (row >= col) { /* Clicked somewhere in-between vertical cargo connection. * Since the horizontal connection is made in the same order as the vertical list, the above condition * ensures we are left-below the main diagonal, thus at the supplying side. */ - return (this->u.cargo.supp_cargoes[row] != INVALID_CARGO) ? this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]] : INVALID_CARGO; + if (this->u.cargo.supp_cargoes[row] == CT_INVALID) return CT_INVALID; + return this->u.cargo.vertical_cargoes[this->u.cargo.supp_cargoes[row]]; } else { /* Clicked at a customer connection. */ - return (this->u.cargo.cust_cargoes[row] != INVALID_CARGO) ? this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]] : INVALID_CARGO; + if (this->u.cargo.cust_cargoes[row] == CT_INVALID) return CT_INVALID; + return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; } + /* Clicked at a customer connection. */ + if (IsValidCargoID(this->u.cargo.cust_cargoes[row])) return this->u.cargo.vertical_cargoes[this->u.cargo.cust_cargoes[row]]; + return CT_INVALID; } /** * Decide what cargo the user clicked in the cargo label field. * @param pt Click position in the cargo label field. - * @return Cargo clicked at, or #INVALID_CARGO if none. + * @return Cargo clicked at, or #CT_INVALID if none. */ CargoID CargoLabelClickedAt(Point pt) const { @@ -2321,11 +2332,11 @@ struct CargoesField { int vpos = vert_inter_industry_space / 2 + CargoesField::cargo_border.height; uint row; for (row = 0; row < MAX_CARGOES; row++) { - if (pt.y < vpos) return INVALID_CARGO; + if (pt.y < vpos) return CT_INVALID; if (pt.y < vpos + FONT_HEIGHT_NORMAL) break; vpos += FONT_HEIGHT_NORMAL + CargoesField::cargo_space.height; } - if (row == MAX_CARGOES) return INVALID_CARGO; + if (row == MAX_CARGOES) return CT_INVALID; return this->u.cargo_label.cargoes[row]; } @@ -2380,7 +2391,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column + 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_produced, INVALID_CARGO, MAX_CARGOES); + std::fill(std::begin(ind_fld->u.industry.other_produced), std::end(ind_fld->u.industry.other_produced), CT_INVALID); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Produced cargoes not carried in the cargo column. @@ -2395,7 +2406,7 @@ struct CargoesRow { /* Allocate other cargoes in the empty holes of the horizontal cargo connections. */ for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) { - if (cargo_fld->u.cargo.supp_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_produced[i] = others[--other_count]; + if (cargo_fld->u.cargo.supp_cargoes[i] == CT_INVALID) ind_fld->u.industry.other_produced[i] = others[--other_count]; } } else { /* Houses only display what is demanded. */ @@ -2414,7 +2425,7 @@ struct CargoesRow { void MakeCargoLabel(int column, bool accepting) { CargoID cargoes[MAX_CARGOES]; - MemSetT(cargoes, INVALID_CARGO, lengthof(cargoes)); + std::fill(std::begin(cargoes), std::end(cargoes), CT_INVALID); CargoesField *label_fld = this->columns + column; CargoesField *cargo_fld = this->columns + (accepting ? column - 1 : column + 1); @@ -2438,7 +2449,7 @@ struct CargoesRow { CargoesField *cargo_fld = this->columns + column - 1; assert(ind_fld->type == CFT_INDUSTRY && cargo_fld->type == CFT_CARGO); - MemSetT(ind_fld->u.industry.other_accepted, INVALID_CARGO, MAX_CARGOES); + std::fill(std::begin(ind_fld->u.industry.other_accepted), std::end(ind_fld->u.industry.other_accepted), CT_INVALID); if (ind_fld->u.industry.ind_type < NUM_INDUSTRYTYPES) { CargoID others[MAX_CARGOES]; // Accepted cargoes not carried in the cargo column. @@ -2453,7 +2464,7 @@ struct CargoesRow { /* Allocate other cargoes in the empty holes of the horizontal cargo connections. */ for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) { - if (cargo_fld->u.cargo.cust_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_accepted[i] = others[--other_count]; + if (cargo_fld->u.cargo.cust_cargoes[i] == CT_INVALID) ind_fld->u.industry.other_accepted[i] = others[--other_count]; } } else { /* Houses only display what is demanded. */ @@ -2591,7 +2602,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: @@ -2636,7 +2647,7 @@ struct IndustryCargoesWindow : public Window { static bool HasCommonValidCargo(const CargoID *cargoes1, uint length1, const CargoID *cargoes2, uint length2) { while (length1 > 0) { - if (*cargoes1 != INVALID_CARGO) { + if (*cargoes1 != CT_INVALID) { for (uint i = 0; i < length2; i++) if (*cargoes1 == cargoes2[i]) return true; } cargoes1++; @@ -2654,7 +2665,7 @@ struct IndustryCargoesWindow : public Window { static bool HousesCanSupply(const CargoID *cargoes, uint length) { for (uint i = 0; i < length; i++) { - if (cargoes[i] == INVALID_CARGO) continue; + if (cargoes[i] == CT_INVALID) continue; if (cargoes[i] == CT_PASSENGERS || cargoes[i] == CT_MAIL) return true; } return false; @@ -2677,7 +2688,7 @@ struct IndustryCargoesWindow : public Window { default: NOT_REACHED(); } for (uint i = 0; i < length; i++) { - if (cargoes[i] == INVALID_CARGO) continue; + if (cargoes[i] == CT_INVALID) continue; for (uint h = 0; h < NUM_HOUSES; h++) { HouseSpec *hs = HouseSpec::Get(h); @@ -2826,7 +2837,7 @@ struct IndustryCargoesWindow : public Window { /* Add suppliers and customers of the 'it' industry. */ int supp_count = 0; int cust_count = 0; - for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { + for (IndustryType it : _sorted_industry_types) { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; @@ -2898,7 +2909,7 @@ struct IndustryCargoesWindow : public Window { /* Add suppliers and customers of the cargo. */ int supp_count = 0; int cust_count = 0; - for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { + for (IndustryType it : _sorted_industry_types) { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; @@ -2937,14 +2948,11 @@ 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) { - if (this->IsWidgetLowered(WID_IC_NOTIFY)) { - this->RaiseWidget(WID_IC_NOTIFY); - this->SetWidgetDirty(WID_IC_NOTIFY); - } + this->RaiseWidgetWhenLowered(WID_IC_NOTIFY); return; } @@ -3037,7 +3045,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: { @@ -3054,13 +3062,13 @@ struct IndustryCargoesWindow : public Window { CargoesField *lft = (fieldxy.x > 0) ? this->fields[fieldxy.y].columns + fieldxy.x - 1 : nullptr; CargoesField *rgt = (fieldxy.x < 4) ? this->fields[fieldxy.y].columns + fieldxy.x + 1 : nullptr; CargoID cid = fld->CargoClickedAt(lft, rgt, xy); - if (cid != INVALID_CARGO) this->ComputeCargoDisplay(cid); + if (cid != CT_INVALID) this->ComputeCargoDisplay(cid); break; } case CFT_CARGO_LABEL: { CargoID cid = fld->CargoLabelClickedAt(xy); - if (cid != INVALID_CARGO) this->ComputeCargoDisplay(cid); + if (cid != CT_INVALID) this->ComputeCargoDisplay(cid); break; } @@ -3147,7 +3155,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; @@ -3155,7 +3163,7 @@ struct IndustryCargoesWindow : public Window { if (!CalculatePositionInWidget(pt, &fieldxy, &xy)) return false; const CargoesField *fld = this->fields[fieldxy.y].columns + fieldxy.x; - CargoID cid = INVALID_CARGO; + CargoID cid = CT_INVALID; switch (fld->type) { case CFT_CARGO: { CargoesField *lft = (fieldxy.x > 0) ? this->fields[fieldxy.y].columns + fieldxy.x - 1 : nullptr; @@ -3178,7 +3186,7 @@ struct IndustryCargoesWindow : public Window { default: break; } - if (cid != INVALID_CARGO && (this->ind_cargo < NUM_INDUSTRYTYPES || cid != this->ind_cargo - NUM_INDUSTRYTYPES)) { + if (cid != CT_INVALID && (this->ind_cargo < NUM_INDUSTRYTYPES || cid != this->ind_cargo - NUM_INDUSTRYTYPES)) { const CargoSpec *csp = CargoSpec::Get(cid); SetDParam(0, csp->name); GuiShowTooltips(this, STR_INDUSTRY_CARGOES_CARGO_TOOLTIP, close_cond, 1); diff --git a/src/ini_type.h b/src/ini_type.h index cbce42ca52..fc25257970 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -92,8 +92,8 @@ struct IniFile : IniLoadFile { bool SaveToDisk(const std::string &filename); - virtual FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size); - virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post); + FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size) override; + void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override; }; #endif /* INI_TYPE_H */ diff --git a/src/intro_gui.cpp b/src/intro_gui.cpp index 46b368da90..d7d2cfd8c9 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. */ @@ -265,7 +265,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); @@ -298,7 +298,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) { @@ -327,7 +327,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. */ @@ -508,7 +508,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); @@ -528,7 +528,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 47911d6ebb..5eb645daf3 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -1035,10 +1035,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; diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index a4f2c7ca11..7ffca0d45e 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecio STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} em {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objeto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo de ferrovia +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo de estrada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Variável NewGRF 60+ parâmetro x (hexadecimal) diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index 19ea63aa6f..2c0603ee2e 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -524,6 +524,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Esborra tots el # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informació de la casella +STR_ABOUT_MENU_HELP :Ajuda i manuals STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Commuta la consola STR_ABOUT_MENU_AI_DEBUG :Depuració de les IA i l'script de partida @@ -1427,6 +1428,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :Cap* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Reduït STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normal +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :Permet passos a nivell amb carreteres o rails dels competidors: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :Permet la construcció de passos a nivell en carreteres o vies ferroviàries que siguin propietat d'altres jugadors. STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Permet situar parades en carreteres que són propietat de les poblacions: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Permet la construcció de passos a nivell als carrers propietat de les poblacions @@ -2123,6 +2126,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Multijug STR_INTRO_GAME_OPTIONS :{BLACK}Opcions del joc STR_INTRO_HIGHSCORE :{BLACK}Taula de rècords +STR_INTRO_HELP :{BLACK}Ajuda i manuals STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Configuració STR_INTRO_NEWGRF_SETTINGS :{BLACK}Extensions NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Contingut en línia @@ -2144,6 +2148,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Seleccio STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Mostra les opcions del joc STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Mostra la taula de rècords +STR_INTRO_TOOLTIP_HELP :{BLACK}Accediu a la documentació i recursos en línia. STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Mostra la finestra de configuració STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Mostra la configuració de les extensions NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Comprova si hi ha continguts nous i actualitzats per a descarregar @@ -2166,6 +2171,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Esteu s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Esteu segur que voleu sortir de l'escenari? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Ajuda i manuals +STR_HELP_WINDOW_WEBSITES :{BLACK}Llocs web +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Documents +STR_HELP_WINDOW_README :{BLACK}Llegeix-me +STR_HELP_WINDOW_CHANGELOG :{BLACK}Registre de canvis +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Errors coneguts +STR_HELP_WINDOW_LICENSE :{BLACK}Llicència +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manual / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Informeu d'un error +STR_HELP_WINDOW_COMMUNITY :Comunitat # Cheat window STR_CHEATS :{WHITE}Trampes @@ -3385,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecci STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} a {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipus de via +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipus de carretera STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Paràmetre NewGRF variable 60+x (hexadecimal) @@ -4700,6 +4717,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Taula de continguts +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Salteu a una secció del fitxer que es mostra amb aquesta llista. +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Torneu enrere segons l'historial de navegació. +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Aneu avant segons l'historial de navegació. STR_TEXTFILE_WRAP_TEXT :{WHITE}Ajusta text STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ajusta el text afegint-hi canvis de línia, de manera que sigui més fàcil desplaçar-se pel text STR_TEXTFILE_VIEW_README :{BLACK}Veure llegeix-me @@ -4710,6 +4732,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}Llegeix- STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Registre de canvis del {STRING} de {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Llicència del {STRING} de {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Vista prèvia del resultat del sondeig +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Document '{STRING}' de l'OpenTTD # Vehicle loading indicators diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 82bb7aaa9a..0f0951da53 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -523,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Slet alle beske # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Landområde information +STR_ABOUT_MENU_HELP :Hjælp & manualer STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Tænd/Sluk konsol STR_ABOUT_MENU_AI_DEBUG :Computerspiller/spilscript debug @@ -2124,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Netværk STR_INTRO_GAME_OPTIONS :{BLACK}Opsætning STR_INTRO_HIGHSCORE :{BLACK} Topresultater +STR_INTRO_HELP :{BLACK}Hjælp og manualer STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Indstillinger STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF indstillinger STR_INTRO_ONLINE_CONTENT :{BLACK}Tjek Online Indhold @@ -2145,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Vælg 'l STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Sæt spillet op STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hvis topscoreliste +STR_INTRO_TOOLTIP_HELP :{BLACK}Få adgang til dokumentation og online ressourcer STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Skærm indstillinger STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Vis NewGRF-indstillinger STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Tjek for nyt og opdateret indhold til download @@ -2167,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Er du s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Er du sikker på, at du vil afslutte dette scenarie ? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Hjælp og manualer +STR_HELP_WINDOW_WEBSITES :{BLACK}Hjemmesider +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenter +STR_HELP_WINDOW_README :{BLACK}Læs mig +STR_HELP_WINDOW_CHANGELOG :{BLACK}Ændringslog +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Kendte Bugs +STR_HELP_WINDOW_LICENSE :{BLACK}Licens +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manual / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Anmeld en fejl +STR_HELP_WINDOW_COMMUNITY :{BLACK}Fællesskab # Cheat window STR_CHEATS :{WHITE}Snydefunktioner @@ -3386,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspicer STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} ved {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objekt STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Jernbanetype +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Vej type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variabel 60+x parameter (hexadecimal) @@ -4701,6 +4716,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Indholdsfortegnelse +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Spring hurtigt til en sektion i den viste fil via denne liste +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Gå tilbage i navigationshistorikken +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Vend tilbage i navigationshistorikken STR_TEXTFILE_WRAP_TEXT :{WHITE}Ombryd tekst STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ombryd teksten i vinduet, så det hele passer uden at skulle rulle STR_TEXTFILE_VIEW_README :{BLACK}Se readme @@ -4711,6 +4731,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} ændringslog for {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} licens for {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :Forhåndsvisning af undersøgelsesresultat +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD dokument '{STRING}' # Vehicle loading indicators diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 1b431a37de..7f370dd7d1 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} bij {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Spoortype +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Wegtype STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parameter 60+x voor NewGRF-variabele (hexadecimaal) diff --git a/src/lang/english.txt b/src/lang/english.txt index a646f503ee..8f2129a22e 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING1} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index c51d9ff405..9902b3158e 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index fc67ddba7d..b510cf53d6 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspect STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Object STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rail type +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road type STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x parameter (hexadecimal) diff --git a/src/lang/extra/czech.txt b/src/lang/extra/czech.txt index a30c92cc9c..a250ee1177 100644 --- a/src/lang/extra/czech.txt +++ b/src/lang/extra/czech.txt @@ -1198,7 +1198,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}Zobrazí STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}P STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}Přejít na číslo spritu... STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}Kliknutí zvýrazní skupinu spritů{}Shift+kliknutí sbalí skupinu spritů{}Ctrl+kliknutí zvýrazní dočasný registr úložiště -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Typ silnice/tramvajové tratě STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :Návěstidla STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_FEATURE_ID :Neimplementované přemapované feature ID: název: {2:STRING}, mapováno na: {5:HEX} (sprite {3:NUM}) STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_PROPERTY :Neimplementované přemapované Action 0 property feature: {4:HEX}, název: {2:STRING}, mapováno na: {5:HEX} (sprite {3:NUM}) diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index e902b8c22a..fb0bee6214 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -1265,7 +1265,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}Display STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}G STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}Scroll to sprite number STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}Click to highlight sprite group{}Shift+Click to collapse sprite group{}Ctrl+Click to highlight temporary storage register -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Road/tram type STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :Signals STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_FEATURE_ID :Unimplemented remapped feature ID: name: {2:RAW_STRING}, mapped to: {5:HEX} (sprite {3:NUM}) STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_PROPERTY :Unimplemented remapped Action 0 property feature: {4:HEX}, name: {2:RAW_STRING}, mapped to: {5:HEX} (sprite {3:NUM}) diff --git a/src/lang/extra/galician.txt b/src/lang/extra/galician.txt index 494358d031..984942ef4c 100644 --- a/src/lang/extra/galician.txt +++ b/src/lang/extra/galician.txt @@ -1224,7 +1224,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}Amosar g STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}G STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}Desprazarse o sprite número STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}Click para destacar o grupo de sprites{}Shift+Click para compactar o grupo de sprites{}Ctrl+Click para destacar o rexistro de almacenamento temporal -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo de estrada/tranvía STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :Sinais STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_FEATURE_ID :Característica non implementada remapeada ID: nome: {2:STRING}, mapeada a: {5:HEX} (sprite {3:NUM}) STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_PROPERTY :Remapeado non implementado dunha característica da propiedade 'Action 0': {4:HEX}, nome: {2:STRING}, mapeado a: {5:HEX} (sprite {3:NUM}) diff --git a/src/lang/extra/german.txt b/src/lang/extra/german.txt index 63851010e6..5c96c5ed9d 100644 --- a/src/lang/extra/german.txt +++ b/src/lang/extra/german.txt @@ -1098,7 +1098,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}Zeige Sp STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}G STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}Scrolle zum Sprite Nummer STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}Klicke, um Sprite-Gruppe hervorzuheben{}Umschalt+Klick, um die Sprite-Gruppe zu schließen{}Strg+Klick, um temporäres Speicherregister hervorzuheben -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Straßen(bahn)typ STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :Signale STR_NEWGRF_TOO_MANY_STRINGS :{WHITE}Nicht genügend String-IDs für alle NewGRFs vorhanden. diff --git a/src/lang/extra/korean.txt b/src/lang/extra/korean.txt index 7c11228a89..7025b18b31 100644 --- a/src/lang/extra/korean.txt +++ b/src/lang/extra/korean.txt @@ -1218,7 +1218,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}모든 STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}G STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}특정 스프라이트 번호로 이동합니다 STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}스프라이트 그룹을 강조 표시하려면 클릭하세요{}SHIFT+클릭하면 스프라이트 그룹을 접거나 펼 수 있습니다.{}Ctrl+클릭하면 임시 저장 레지스터를 강조 표시합니다. -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :도로/전차 종류 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :신호기 STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_FEATURE_ID :구현되지 않은 재배치된 기능 ID: 이름: {2:STRING}, 재배치: {5:HEX} (스프라이트 {3:NUM}) STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_PROPERTY :구현되지 않은 재배치된 액션 0 속성 특성: {4:HEX}, 이름: {2:STRING}, 재배치: {5:HEX} (스프라이트 {3:NUM}) diff --git a/src/lang/extra/simplified_chinese.txt b/src/lang/extra/simplified_chinese.txt index 7b998d862e..0804a85467 100644 --- a/src/lang/extra/simplified_chinese.txt +++ b/src/lang/extra/simplified_chinese.txt @@ -1217,7 +1217,6 @@ STR_NEWGRF_INSPECT_SPRITE_DUMP_UNOPT_TOOLTIP :{BLACK}在没 STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO :{BLACK}G STR_NEWGRF_INSPECT_SPRITE_DUMP_GOTO_TOOLTIP :{BLACK}滚动Sprite编号 STR_NEWGRF_INSPECT_SPRITE_DUMP_PANEL_TOOLTIP :{BLACK}点击高亮Sprite组{}Shift+点击折叠Sprite组{}Ctrl+点击高亮临时存储寄存器 -STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :道路/电车道类型 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_SIGNALS :信号 STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_FEATURE_ID :未生效的重映射特性 ID: name: {2:STRING},mapped to: {5:HEX} (sprite {3:NUM}) STR_NEWGRF_ERROR_UNIMPLEMETED_MAPPED_PROPERTY :未生效的重映射 Action 0 属性特性: {4:HEX},name: {2:STRING},mapped to: {5:HEX} (sprite {3:NUM}) diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index aad0be1065..548742eae0 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -3400,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Tutki va STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} sijainnissa {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objekti STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Rautatien tyyppi +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tien tyyppi STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF muuttujan 60+x parametri (heksadesimaali) diff --git a/src/lang/french.txt b/src/lang/french.txt index 2f8a48c07e..4a0ae2b3be 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecte STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} à {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objet STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Type de rail +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Type de route STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Paramètre de variable NewGRF 60+x (héxadecimal) diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 3673445fee..a886316fa9 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -525,6 +525,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Elimina tutti i # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informazioni sull'area di terreno +STR_ABOUT_MENU_HELP :Aiuto e manuali STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Apri/chiudi console STR_ABOUT_MENU_AI_DEBUG :Debug IA/Script @@ -1461,6 +1462,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :Nessuno* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :Ridotto STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :Normale +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :Consenti passaggi a livello con strade o ferrovie di proprietà dei concorrenti: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :Consenti la realizzazione di passaggi a livello su strade o rotaie di proprietà dei concorrenti STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :Consenti fermate passanti sulle strade di proprietà delle città: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :Permettere la costruzione di fermate stradali passanti sulle strade di proprietà delle città. @@ -2157,6 +2160,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Multigio STR_INTRO_GAME_OPTIONS :{BLACK}Opzioni di gioco STR_INTRO_HIGHSCORE :{BLACK}Punteggi migliori +STR_INTRO_HELP :{BLACK}Aiuto e manuali STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Impostazioni STR_INTRO_NEWGRF_SETTINGS :{BLACK}Impostazioni NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Contenuti online @@ -2178,6 +2182,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Selezion STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Mostra le opzioni di gioco STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Mostra la tabella dei punteggi migliori +STR_INTRO_TOOLTIP_HELP :{BLACK}Ottieni l'accesso alla documentazione e alle risorse online STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Mostra le impostazioni STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Mostra le impostazioni NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Controlla la disponibilità di contenuti nuovi o aggiornati da scaricare @@ -2200,6 +2205,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Si è s STR_ABANDON_SCENARIO_QUERY :{YELLOW}Si è sicuri di voler abbandonare questo scenario? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Aiuto e manuali +STR_HELP_WINDOW_WEBSITES :{BLACK}Siti web +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Documenti +STR_HELP_WINDOW_README :{BLACK}Leggimi +STR_HELP_WINDOW_CHANGELOG :{BLACK}Changelog +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Bug conosciuti +STR_HELP_WINDOW_LICENSE :{BLACK}Licenza +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Manuale / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Segnala un bug +STR_HELP_WINDOW_COMMUNITY :{BLACK}Community # Cheat window STR_CHEATS :{WHITE}Trucchi @@ -2688,6 +2704,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}Attiva/d STR_TRANSPARENT_BRIDGES_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza dei ponti. CTRL+clic per bloccare STR_TRANSPARENT_STRUCTURES_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza di strutture come fari e antenne. CTRL+clic per bloccare STR_TRANSPARENT_CATENARY_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza delle catenarie. CTRL+clic per bloccare +STR_TRANSPARENT_TEXT_TOOLTIP :{BLACK}Attiva/disattiva la trasparenza per il caricamento e il testo costi/entrate. Ctrl+clic per bloccare STR_TRANSPARENT_INVISIBLE_TOOLTIP :{BLACK}Rendi gli oggetti invisibili invece che trasparenti # Linkgraph legend window @@ -3268,7 +3285,7 @@ STR_MAPGEN_NEWGRF_SETTINGS_TOOLTIP :{BLACK}Mostra i STR_MAPGEN_AI_SETTINGS :{BLACK}Impostazioni IA STR_MAPGEN_AI_SETTINGS_TOOLTIP :{BLACK}Mostra impostazioni IA STR_MAPGEN_GS_SETTINGS :{BLACK}Impostazioni script di gioco -STR_MAPGEN_GS_SETTINGS_TOOLTIP :BLACK}Visualizza le impostazioni dello script di gioco +STR_MAPGEN_GS_SETTINGS_TOOLTIP :{BLACK}Visualizza le impostazioni dello script di gioco ###length 21 STR_MAPGEN_TOWN_NAME_ORIGINAL_ENGLISH :Inglesi (originali) @@ -3424,6 +3441,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Ispezion STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} a {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Oggetto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo di rotaie +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo di strada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parametro variabile NewGRF 60+x (esadecimale) @@ -4739,6 +4757,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Sommario +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Passa rapidamente a una sezione del file visualizzato tramite questo elenco +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Torna indietro nella cronologia di navigazione +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Vai avanti nella cronologia di navigazione STR_TEXTFILE_WRAP_TEXT :{WHITE}A capo automatico STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Manda automaticamente a capo il testo della finestra in modo che sia visibile senza doverlo scorrere STR_TEXTFILE_VIEW_README :{BLACK}Visualizza file leggimi @@ -4749,6 +4772,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}File leg STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Changelog del {STRING} {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Licenza del {STRING} {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Anteprima del risultato del sondaggio +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Documento OpenTTD '{STRING}' # Vehicle loading indicators diff --git a/src/lang/korean.txt b/src/lang/korean.txt index 4adecfdc4f..91626507a2 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -930,7 +930,7 @@ STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO :{WHITE}{STATION STR_NEWS_STATION_NOW_ACCEPTS_CARGO :{WHITE}{STATION}에서 이제 {STRING}{G 1 "을" "를"} 받을 수 있습니다. STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO :{WHITE}{STATION}에서 이제 {STRING}/{STRING}{G 2 "을" "를"} 받을 수 있습니다. -STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 계약 파기:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다. +STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED :{BIG_FONT}{BLACK}보조금 지급 종료:{}{}{1:STRING}에서 {2:STRING}까지의 {0:STRING} 수송은{}더 이상 보조금을 지급하지 않습니다. STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE :{BIG_FONT}{BLACK}보조금 지급 만료:{}{}{1:STRING}에서 {2:STRING}까지의{}{0:STRING} 수송 보조금은 더 이상 지급되지 않습니다. STR_NEWS_SERVICE_SUBSIDY_OFFERED :{BIG_FONT}{BLACK}보조금 지급 안내{}{}처음으로 {1:STRING}에서 {2:STRING}까지{}{0:STRING}{G 0 "을" "를"} 수송하는 회사는{}지역 당국으로부터 {3:NUM}년 동안 보조금을 받게 될 것입니다! ###length 4 @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}상위 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING}, {HEX}에서 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :오브젝트 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :철도 종류 +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :도로 종류 STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF 변수 60+x 매개 변수 (16진법) diff --git a/src/lang/polish.txt b/src/lang/polish.txt index 8e3b26fe87..4dac9495ac 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -902,6 +902,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Usuń wszystkie # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Informacje o terenie +STR_ABOUT_MENU_HELP :Pomoc i instrukcje STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Przełącz konsolę STR_ABOUT_MENU_AI_DEBUG :Debugowanie SI / Game Script @@ -1023,7 +1024,7 @@ STR_GRAPH_KEY_COMPANY_SELECTION_TOOLTIP :{BLACK}Kliknij # Company league window STR_COMPANY_LEAGUE_TABLE_CAPTION :{WHITE}Ranking firm -STR_COMPANY_LEAGUE_COMPANY_NAME :{ORANGE}{COMPANY} {BLACK}{COMPANY_NUM} '{STRING}' +STR_COMPANY_LEAGUE_COMPANY_NAME :{ORANGE}{COMPANY} {BLACK}{COMPANY_NUM} „{STRING}” STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_ENGINEER :Inżynier STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRAFFIC_MANAGER :Administrator Ruchu STR_COMPANY_LEAGUE_PERFORMANCE_TITLE_TRANSPORT_COORDINATOR :Koordynator Transportu @@ -1123,9 +1124,9 @@ STR_HIGHSCORE_PERFORMANCE_TITLE_MAGNATE :Magnat STR_HIGHSCORE_PERFORMANCE_TITLE_MOGUL :Potentat STR_HIGHSCORE_PERFORMANCE_TITLE_TYCOON_OF_THE_CENTURY :Tycoon Stulecia STR_HIGHSCORE_NAME :{PRESIDENT_NAME}, {COMPANY} -STR_HIGHSCORE_STATS :{BIG_FONT}'{STRING}' ({COMMA}) -STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} osiąga status: '{STRING}'! -STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} z {COMPANY} osiągnęło status '{STRING}'! +STR_HIGHSCORE_STATS :{BIG_FONT}„{STRING}” ({COMMA}) +STR_HIGHSCORE_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{BLACK}{COMPANY} osiąga status: „{STRING}”! +STR_HIGHSCORE_PRESIDENT_OF_COMPANY_ACHIEVES_STATUS :{BIG_FONT}{WHITE}{PRESIDENT_NAME} z {COMPANY} osiągnęło status „{STRING}”! # Smallmap window STR_SMALLMAP_CAPTION :{WHITE}Mapa - {STRING} @@ -1231,10 +1232,10 @@ STR_NEWS_AIRCRAFT_CRASH :{BIG_FONT}{BLAC STR_NEWS_PLANE_CRASH_OUT_OF_FUEL :{BIG_FONT}{BLACK}Wypadek lotniczy!{}Samolot rozbił się z powodu braku paliwa, zginęł{P 0 a y o} {COMMA} os{P oba oby ób}! STR_NEWS_DISASTER_ZEPPELIN :{BIG_FONT}{BLACK}Katastrofa Zeppelina na {STATION}! -STR_NEWS_DISASTER_SMALL_UFO :{BIG_FONT}{BLACK}Pojazd zniszczony w kolizji z 'UFO'! +STR_NEWS_DISASTER_SMALL_UFO :{BIG_FONT}{BLACK}Pojazd zniszczony w kolizji z „UFO”! STR_NEWS_DISASTER_AIRPLANE_OIL_REFINERY :{BIG_FONT}{BLACK}Eksplozja rafinerii w pobliżu {TOWN}! STR_NEWS_DISASTER_HELICOPTER_FACTORY :{BIG_FONT}{BLACK}Fabryka zniszczona w podejrzanych okolicznościach w pobliżu {TOWN}! -STR_NEWS_DISASTER_BIG_UFO :{BIG_FONT}{BLACK}'UFO' wylądowało w pobliżu {TOWN}! +STR_NEWS_DISASTER_BIG_UFO :{BIG_FONT}{BLACK}„UFO” wylądowało w pobliżu {TOWN}! STR_NEWS_DISASTER_COAL_MINE_SUBSIDENCE :{BIG_FONT}{BLACK}Tąpnięcie przy kopalni pozostawiło pas zniszczenia blisko {TOWN}! STR_NEWS_DISASTER_FLOOD_VEHICLE :{BIG_FONT}{BLACK}Powódź!{}Przynajmniej {COMMA} zaginęło lub utonęło w czasie powodzi! @@ -1571,7 +1572,7 @@ STR_CITY_APPROVAL_TOLERANT :Tolerancyjne STR_CITY_APPROVAL_HOSTILE :Wrogie STR_CITY_APPROVAL_PERMISSIVE :Przyjazne (bez wpływu na działania firmy) -STR_WARNING_NO_SUITABLE_AI :{WHITE}Brak pasujących SI...{}Możesz pobrać wszystkie SI przez system "Dodatki online" +STR_WARNING_NO_SUITABLE_AI :{WHITE}Brak pasujących SI...{}Możesz pobrać wszystkie SI przez przeglądarkę „Dodatków Online” # Settings tree window STR_CONFIG_SETTING_TREE_CAPTION :{WHITE}Ustawienia @@ -1680,7 +1681,7 @@ STR_CONFIG_SETTING_CITY_APPROVAL :Nastawienie wł STR_CONFIG_SETTING_CITY_APPROVAL_HELPTEXT :Wybierz, jak bardzo hałas i niszczenie środowiska przez firmy wpływają na ich ocenę w mieście i na dalsze działania związane z budową na jego obszarze STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT :Limit wysokości mapy: {STRING} -STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT :Ustawia limit wysokości mapy. Z ustawieniem "(automatyczna)" odpowiednia wartość zostanie dobrana po wygenerowaniu terenu +STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_HELPTEXT :Ustawia limit wysokości mapy. Z ustawieniem „(automatyczna)” odpowiednia wartość zostanie dobrana po wygenerowaniu terenu STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_VALUE :{NUM} ###setting-zero-is-special STR_CONFIG_SETTING_MAP_HEIGHT_LIMIT_AUTO :(automatyczna) @@ -1759,7 +1760,7 @@ STR_CONFIG_SETTING_SIGNALSIDE_RIGHT :Po prawej STR_CONFIG_SETTING_SHOWFINANCES :Pokazuj okno finansów na koniec roku: {STRING} STR_CONFIG_SETTING_SHOWFINANCES_HELPTEXT :Jeśli włączone, to okienko finansowe pokazuje się na zakończenie każdego roku, by ułatwić śledzenie sytuacji finansowej firmy -STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Nowe polecenia są domyślnie 'bez zatrzymywania się': {STRING} +STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :Nowe polecenia są domyślnie „bez zatrzymywania się”: {STRING} STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :Normalnie pojazd zatrzyma się na każdej stacji, przez którą przejeżdża. Po włączeniu tej opcji, pojazd przejedzie do swojego celu bez zatrzymywania się. Zwróć uwagę na to, że to ustawienie ma wpływ tylko na nowe polecenia. Pojedyncze polecenia mogą być ustalane bez względu na wartość tej opcji STR_CONFIG_SETTING_STOP_LOCATION :Nowe rozkazy pociągu kończą się domyślnie na {STRING} peronu @@ -1894,7 +1895,7 @@ STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :Maksymalna odle STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Rafinerie są budowane tylko w pobliżu krawędzi map, to znaczy na wybrzeżach dla map wyspiarskich. To ustawienie pozwala ograniczyć jak daleko od krawędzi mapy mogą być budowane rafinerie i platformy wiertnicze. Na mapach większych niż 256 pól, wartość ta jest skalowana w górę. STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Wysokość granicy wiecznych śniegów: {STRING} -STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wysokość linii śniegu w klimacie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana wyłącznie poprzez Edytor scenariusza, normalnie jest obliczana za pomocą ustawienia "pokrycia śniegiem" +STR_CONFIG_SETTING_SNOWLINE_HEIGHT_HELPTEXT :Wysokość linii śniegu w klimacie arktycznym. Poziom pokrywy śnieżnej wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Może być zmodyfikowana poprzez Edytor Scenariuszy, w innym przypadku jest obliczana za pomocą ustawienia „pokrycie śniegiem” STR_CONFIG_SETTING_SNOW_COVERAGE :Pokrycie śniegiem: {STRING} STR_CONFIG_SETTING_SNOW_COVERAGE_HELPTEXT :Ustawia przybliżoną ilość śniegu w krajobrazie arktycznym. Śnieg wpływa również wpływa na rozmieszczenie przedsiębiorstw i na warunki rozwoju miast. Używane tylko podczas generowania mapy. Teren tuż ponad poziomem morza jest zawsze bez śniegu @@ -1919,7 +1920,7 @@ STR_CONFIG_SETTING_RIVER_AMOUNT :Liczba rzek: {S STR_CONFIG_SETTING_RIVER_AMOUNT_HELPTEXT :Określa liczbę rzek na mapie STR_CONFIG_SETTING_TREE_PLACER :Algorytm rozmieszczenia drzew: {STRING} -STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Metoda generowania terenów zalesionych. Algorytm "Oryginalny" rozmieszcza drzewa równomiernie na całej mapie, a "Ulepszony" gromadzi je w skupiska +STR_CONFIG_SETTING_TREE_PLACER_HELPTEXT :Metoda generowania terenów zalesionych. Algorytm „oryginalny” rozmieszcza drzewa równomiernie na całej mapie, a „ulepszony” gromadzi je w skupiska ###length 3 STR_CONFIG_SETTING_TREE_PLACER_NONE :Brak STR_CONFIG_SETTING_TREE_PLACER_ORIGINAL :Oryginalny @@ -2009,7 +2010,7 @@ STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK_FOCUS :Pojedyncze klik STR_CONFIG_SETTING_OSK_ACTIVATION_SINGLE_CLICK :Pojedyncze kliknięcie (natychmiast) STR_CONFIG_SETTING_USE_RELAY_SERVICE :Używanie usługi przekaźnika: {STRING} -STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT :Jeśli nawiązanie połączenia z serwerem nie powiedzie się, można użyć usługi przekaźnika do nawiązania połączenia. „Nigdy" nie zezwoli na to, „pytaj” najpierw zapyta, „zezwól” pozwoli na to bez pytania +STR_CONFIG_SETTING_USE_RELAY_SERVICE_HELPTEXT :Jeśli nawiązanie połączenia z serwerem nie powiedzie się, można użyć usługi przekaźnika do nawiązania połączenia. „Nigdy” nie zezwoli na to, „pytaj” najpierw zapyta, „zezwól” pozwoli na to bez pytania ###length 3 STR_CONFIG_SETTING_USE_RELAY_SERVICE_NEVER :Nigdy STR_CONFIG_SETTING_USE_RELAY_SERVICE_ASK :Pytaj @@ -2029,11 +2030,11 @@ STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_NO :Nie STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES :Tak STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES_EXCEPT_STICKY :Tak, z wyjątkiem przypiętych -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :Użyj {STRING} formatu daty dla nazw zapisów gry +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :Użyj daty w formacie {STRING} dla nazw zapisów gry STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_HELPTEXT :Format daty w nazwach plików zapisu gry ###length 3 -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :długiego (31 grudnia 2008) -STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT :krótkiego (31-12-2008) +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_LONG :długim (31 grudnia 2008) +STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_SHORT :krótkim (31-12-2008) STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_ISO :ISO (2008-12-31) STR_CONFIG_SETTING_PAUSE_ON_NEW_GAME :Automatycznie włącz pauzę przy rozpoczęciu nowej gry: {STRING} @@ -2060,10 +2061,10 @@ STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE :Pokazuj przyjaz STR_CONFIG_SETTING_TIMETABLE_SHOW_ARRIVAL_DEPARTURE_HELPTEXT :Wyświetlanie przewidywanego przyjazdu i odjazdu w rozkładach STR_CONFIG_SETTING_QUICKGOTO :Szybkie tworzenie poleceń pojazdu: {STRING} -STR_CONFIG_SETTING_QUICKGOTO_HELPTEXT :Po wybraniu stacji docelowej automatycznie włącz ponownie narzędzie 'idź do' +STR_CONFIG_SETTING_QUICKGOTO_HELPTEXT :Po wybraniu stacji docelowej automatycznie włącz ponownie narzędzie „idź do” STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE :Domyślny typ torów: {STRING} -STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_HELPTEXT :Rodzaj torów wybierany przy rozpoczęciu lub załadowaniu gry. 'Pierwszy dostępny' wybiera najstarszy rodzaj torów, 'najnowszy' wybiera najnowszy rodzaj torów, a 'najczęściej używany' wybiera ten, który jest używany najczęściej +STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_HELPTEXT :Rodzaj torów wybierany przy rozpoczęciu lub załadowaniu gry. „Pierwszy dostępny” wybiera najstarszy rodzaj torów, „najnowszy” wybiera najnowszy rodzaj torów, a „najczęściej używany” wybiera ten, który jest używany najczęściej ###length 3 STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_FIRST :pierwszy dostępny STR_CONFIG_SETTING_DEFAULT_RAIL_TYPE_LAST :najnowszy @@ -2469,21 +2470,21 @@ STR_CONFIG_SETTING_QUERY_CAPTION :{WHITE}Zmiana w # Config errors STR_CONFIG_ERROR :{WHITE}Błąd w pliku konfiguracyjnym -STR_CONFIG_ERROR_ARRAY :{WHITE}... błąd w tablicy '{STRING}' -STR_CONFIG_ERROR_INVALID_VALUE :{WHITE}... nieprawidłowa wartość '{STRING}' dla '{STRING}' -STR_CONFIG_ERROR_TRAILING_CHARACTERS :{WHITE}... zbędne znaki na końcu ustawienia '{STRING}' -STR_CONFIG_ERROR_DUPLICATE_GRFID :{WHITE}... ignorowanie NewGRF-a '{STRING}': zduplikowany GRF ID z '{STRING}' -STR_CONFIG_ERROR_INVALID_GRF :{WHITE}... pominięcie nieprawidłowych NewGRF-ów '{STRING}': {STRING} +STR_CONFIG_ERROR_ARRAY :{WHITE}... błąd w tablicy „{STRING}” +STR_CONFIG_ERROR_INVALID_VALUE :{WHITE}... nieprawidłowa wartość „{STRING}” dla „{STRING}” +STR_CONFIG_ERROR_TRAILING_CHARACTERS :{WHITE}... zbędne znaki na końcu ustawienia „{STRING}” +STR_CONFIG_ERROR_DUPLICATE_GRFID :{WHITE}... ignorowanie NewGRF-a „{STRING}”: zduplikowany GRF ID z „{STRING}” +STR_CONFIG_ERROR_INVALID_GRF :{WHITE}... pominięcie nieprawidłowych NewGRF-ów „{STRING}”: {STRING} STR_CONFIG_ERROR_INVALID_GRF_NOT_FOUND :nie znaleziono STR_CONFIG_ERROR_INVALID_GRF_UNSAFE :{G=n}niebezpieczne w stałym użyciu STR_CONFIG_ERROR_INVALID_GRF_SYSTEM :systemowe NewGRF STR_CONFIG_ERROR_INVALID_GRF_INCOMPATIBLE :niezgodne z tą wersją OpenTTD STR_CONFIG_ERROR_INVALID_GRF_UNKNOWN :nieznany -STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... poziom kompresji '{STRING}' nie jest poprawny -STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM :{WHITE}... format zapisu gry '{STRING}' jest niedostępny. Powracanie do '{STRING}' -STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Graphics '{STRING}': nie odnaleziono -STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Sounds '{STRING}': nie odnaleziono -STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignoruję zestaw Base Music '{STRING}': nie odnaleziono +STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_LEVEL :{WHITE}... poziom kompresji „{STRING}” jest niepoprawny +STR_CONFIG_ERROR_INVALID_SAVEGAME_COMPRESSION_ALGORITHM :{WHITE}... format zapisu gry „{STRING}” jest niedostępny. Powracanie do „{STRING}” +STR_CONFIG_ERROR_INVALID_BASE_GRAPHICS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Graphics „{STRING}”: nie odnaleziono +STR_CONFIG_ERROR_INVALID_BASE_SOUNDS_NOT_FOUND :{WHITE}... ignoruję zestaw Base Sounds „{STRING}”: nie odnaleziono +STR_CONFIG_ERROR_INVALID_BASE_MUSIC_NOT_FOUND :{WHITE}... ignoruję zestaw Base Music „{STRING}”: nie odnaleziono STR_CONFIG_ERROR_OUT_OF_MEMORY :{WHITE}Brak pamięci STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}Nie powiodła się rezerwacja pamięci cache dla sprite'ów od wielkości {BYTES}. Pamięć cache sprite'ów została zredukowana do {BYTES}. Obniży to wydajność OpenTTD. By zmniejszyć zapotrzebowanie pamięci, możesz spróbować wyłączyć grafikę 32bpp i/lub poziomy zbliżenia @@ -2504,9 +2505,10 @@ STR_INTRO_MULTIPLAYER :{BLACK}Gra wiel STR_INTRO_GAME_OPTIONS :{BLACK}Opcje gry STR_INTRO_HIGHSCORE :{BLACK}Tabela wyników +STR_INTRO_HELP :{BLACK}Pomoc i Instrukcje STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Ustawienia STR_INTRO_NEWGRF_SETTINGS :{BLACK}Ustawienia NewGRF -STR_INTRO_ONLINE_CONTENT :{BLACK}Sprawdź dodatki online +STR_INTRO_ONLINE_CONTENT :{BLACK}Sprawdź Dodatki Online STR_INTRO_AI_SETTINGS :{BLACK}Ustawienia SI STR_INTRO_GAMESCRIPT_SETTINGS :{BLACK}Ustawienia Game Script STR_INTRO_QUIT :{BLACK}Wyjście @@ -2525,6 +2527,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Wybierz STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Wyświetl opcje gry STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Wyświetl tabelę wyników +STR_INTRO_TOOLTIP_HELP :{BLACK}Uzyskaj dostęp do dokumentacji i zasobów online STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Wyświetl ustawienia gry STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Wyświetl ustawienia NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Poszukaj nowych lub zaktualizowanych dodatków do pobrania @@ -2547,6 +2550,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Czy na STR_ABANDON_SCENARIO_QUERY :{YELLOW}Czy na pewno chcesz porzucić ten scenariusz? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Pomoc i Instrukcje +STR_HELP_WINDOW_WEBSITES :{BLACK}Strony internetowe +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Dokumenty +STR_HELP_WINDOW_README :{BLACK}Plik „readme” +STR_HELP_WINDOW_CHANGELOG :{BLACK}Lista Zmian +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Znane Błędy +STR_HELP_WINDOW_LICENSE :{BLACK}Licencja +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Podręcznik / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Zgłoś Błąd +STR_HELP_WINDOW_COMMUNITY :{BLACK}Społeczność # Cheat window STR_CHEATS :{WHITE}Oszustwa @@ -2623,7 +2637,7 @@ STR_FACE_FACECODE :{BLACK}Numer tw STR_FACE_FACECODE_TOOLTIP :{BLACK}Obejrzyj i/lub ustaw numer twarzy prezesa firmy STR_FACE_FACECODE_CAPTION :{WHITE}Obejrzyj i/lub ustaw numer twarzy prezesa STR_FACE_FACECODE_SET :{WHITE}Ustawiono nowy numer twarzy gracza -STR_FACE_FACECODE_ERR :{WHITE}Nie można ustawić numeru twarzy prezesa - musi być liczbą pomiędzy 0 a 4'294'967'295! +STR_FACE_FACECODE_ERR :{WHITE}Nie można ustawić numeru twarzy prezesa - musi być liczbą pomiędzy 0 a 4{NBSP}294{NBSP}967{NBSP}295! STR_FACE_SAVE :{BLACK}Zapisz STR_FACE_SAVE_TOOLTIP :{BLACK}Zapisz ulubioną twarz STR_FACE_SAVE_DONE :{WHITE}Ta twarz będzie zapisana w pliku konfiguracyjnym OpenTTD jako twoja ulubiona @@ -2858,7 +2872,7 @@ STR_NETWORK_CHAT_CLIENT :[Prywatna] {STR STR_NETWORK_CHAT_TO_CLIENT :[Prywatna] Do {STRING}: {WHITE}{STRING} STR_NETWORK_CHAT_ALL :[Wszyscy] {STRING}: {WHITE}{STRING} STR_NETWORK_CHAT_EXTERNAL :[{3:STRING}] {0:STRING}: {WHITE}{1:STRING} -STR_NETWORK_CHAT_OSKTITLE :{BLACK}Wpisz tekst do chat'u +STR_NETWORK_CHAT_OSKTITLE :{BLACK}Wprowadź tekst do czatu sieciowego # Network messages STR_NETWORK_ERROR_NOTAVAILABLE :{WHITE}Nie znaleziono urządzeń sieciowych @@ -2988,7 +3002,7 @@ STR_CONTENT_DETAIL_FILESIZE :{SILVER}Rozmiar STR_CONTENT_DETAIL_SELECTED_BECAUSE_OF :{SILVER}Zaznaczono z powodu: {WHITE}{STRING} STR_CONTENT_DETAIL_DEPENDENCIES :{SILVER}Zależności: {WHITE}{STRING} STR_CONTENT_DETAIL_TAGS :{SILVER}Tagi: {WHITE}{STRING} -STR_CONTENT_NO_ZLIB :{WHITE}OpenTTD jest zbudowany bez wsparcia dla "zlib"... +STR_CONTENT_NO_ZLIB :{WHITE}OpenTTD jest zbudowany bez wsparcia dla „zlib”... STR_CONTENT_NO_ZLIB_SUB :{WHITE}... pobieranie zawartości nie jest możliwe! # Order of these is important! @@ -3114,7 +3128,7 @@ STR_STATION_BUILD_NUMBER_OF_TRACKS_TOOLTIP :{BLACK}Wybierz STR_STATION_BUILD_PLATFORM_LENGTH :{BLACK}Długość peronu STR_STATION_BUILD_PLATFORM_LENGTH_TOOLTIP :{BLACK}Wybierz długość stacji STR_STATION_BUILD_DRAG_DROP :{BLACK}Przeciągnij i upuść -STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}Buduj stację używając "przeciągnij i upuść" +STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}Buduj stację używając „przeciągnij i upuść” STR_STATION_BUILD_STATION_CLASS_TOOLTIP :{BLACK}Wybierz rodzaj stacji do pokazania STR_STATION_BUILD_STATION_TYPE_TOOLTIP :{BLACK}Wybierz typ stacji do zbudowania @@ -3131,13 +3145,13 @@ STR_BUILD_SIGNAL_TOGGLE_ADVANCED_SIGNAL_TOOLTIP :{BLACK}Przełą STR_BUILD_SIGNAL_SEMAPHORE_NORM_TOOLTIP :{BLACK}Sygnalizator bloku (semafor){}Najprostszy typ sygnału pozwalający na przebywanie w jednym bloku wyłącznie jednemu pociągowi naraz STR_BUILD_SIGNAL_SEMAPHORE_ENTRY_TOOLTIP :{BLACK}Sygnalizator wejściowy (semafor){}Zielony, póki choć jeden sygnalizator wyjściowy dla kolejnego odcinka trasy jest zielony. W przeciwnym wypadku czerwony. STR_BUILD_SIGNAL_SEMAPHORE_EXIT_TOOLTIP :{BLACK}Sygnalizator wyjściowy (semafor){}Zachowuje się jak sygnalizator blokowy, lecz jest niezbędny do zmiany na poprawny kolor w presygnalizatorach wejściowych i złożonych -STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (semafor){}Sygnalizator złożony zachowuje się jak kombinacja sygnalizatorów wejściowych oraz wyjściowych. Umożliwia to budowę wielkich "drzew" presygnalizatorów +STR_BUILD_SIGNAL_SEMAPHORE_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (semafor){}Sygnalizator złożony zachowuje się jak kombinacja sygnalizatorów wejściowych oraz wyjściowych. Umożliwia to budowę wielkich „drzew” presygnalizatorów STR_BUILD_SIGNAL_SEMAPHORE_PBS_TOOLTIP :{BLACK}Sygnalizator trasy (semafor){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Zwykłe sygnalizatory trasy mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_SEMAPHORE_PBS_OWAY_TOOLTIP :{BLACK}Jednokierunkowy sygnalizator trasy (semafor){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Sygnalizatory jednokierunkowe nie mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_ELECTRIC_NORM_TOOLTIP :{BLACK}Sygnalizator bloku (elektryczny){}Najprostszy typ sygnału pozwalający na przebywanie w jednym bloku wyłącznie jednemu pociągowi naraz STR_BUILD_SIGNAL_ELECTRIC_ENTRY_TOOLTIP :{BLACK}Sygnalizator wejściowy (elektryczny){}Zielony, póki choć jeden sygnalizator wyjściowy dla kolejnego odcinka trasy jest zielony. W przeciwnym przypadku czerwony STR_BUILD_SIGNAL_ELECTRIC_EXIT_TOOLTIP :{BLACK}Sygnalizator wyjściowy (elektryczny){}Zachowuje się jak sygnalizator blokowy, lecz jest niezbędny do zmiany na poprawny kolor w presygnalizatorach wejściowych i złożonych -STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (elektryczny){}Sygnalizator złożony działa jako sygnał wejściowy i wyjściowy. Umożliwia to budowę wielkich "drzew" presygnalizatorów +STR_BUILD_SIGNAL_ELECTRIC_COMBO_TOOLTIP :{BLACK}Sygnalizator złożony (elektryczny){}Sygnalizator złożony działa jako sygnał wejściowy i wyjściowy. Umożliwia to budowę wielkich „drzew” presygnalizatorów STR_BUILD_SIGNAL_ELECTRIC_PBS_TOOLTIP :{BLACK}Sygnalizator trasy (elektryczny){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Zwykłe sygnalizatory trasy mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_ELECTRIC_PBS_OWAY_TOOLTIP :{BLACK}Jednokierunkowy sygnalizator trasy (elektryczny){}Sygnalizator trasy umożliwiający wejście więcej niż jednemu pociagowi do bloku sygnalizatorów, o ile pociąg może zarezerwować trasę do bezpiecznego punktu zatrzymania. Sygnalizatory jednokierunkowe nie mogą być mijane w przeciwnym kierunku STR_BUILD_SIGNAL_CONVERT_TOOLTIP :{BLACK}Zamiana sygnałów{}Jeżeli włączone, kliknięcie na istniejący sygnał spowoduje zamianę go na wybrany typ i wariant. Ctrl+klik przełącza istniejący wariant. Shift+klik pokazuje szacowany koszt zamiany @@ -3766,6 +3780,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Zbadaj o STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} w {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Obiekt STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Typ szyn +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Rodzaj drogi STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGFR zmienna 60+parametr x (heksadecymalnie) @@ -3822,7 +3837,7 @@ STR_NEWGRF_ERROR_GRM_FAILED :Potrzebne źró STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:STRING} został wyłączony przez {STRING} STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Niepoprawny/nieznany format układu sprite'u (sprite {3:NUM}) STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :Zbyt wiele elementów na liście wartości właściwości (sprite {3:NUM}, właściwość {4:HEX}) -STR_NEWGRF_ERROR_INDPROD_CALLBACK :Niewłaściwy wywołanie produkcji przedsiębiorstwa (sprite {3:NUM}, "{2:STRING}") +STR_NEWGRF_ERROR_INDPROD_CALLBACK :Nieprawidłowe wywołanie zwrotne produkcji przedsiębiorstwa (sprite {3:NUM}, „{2:STRING}”) # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Uwaga! @@ -3845,17 +3860,17 @@ STR_NEWGRF_LIST_COMPATIBLE :{YELLOW}Znalezi STR_NEWGRF_LIST_MISSING :{RED}Brakujące pliki # NewGRF 'it's broken' warnings -STR_NEWGRF_BROKEN :{WHITE}Zachowanie NewGRF '{0:STRING}' może powodować desynchronizacje i/lub błędy -STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Zmieniony stan wagonu silnikowego '{1:ENGINE}', gdy był poza halą warsztatów -STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Zmiana długości pojazdu '{1:ENGINE}' , który nie jest zatrzymany w hali -STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Zmieniono ładowność pojazdu na '{1:ENGINE}', kiedy nie był w hali warsztatów lub w trakcie przebudowy +STR_NEWGRF_BROKEN :{WHITE}Zachowanie NewGRF „{0:STRING}” może powodować desynchronizacje i/lub błędy +STR_NEWGRF_BROKEN_POWERED_WAGON :{WHITE}Zmieniony stan wagonu silnikowego „{1:ENGINE}”, gdy był poza halą warsztatów +STR_NEWGRF_BROKEN_VEHICLE_LENGTH :{WHITE}Zmiana długości pojazdu „{1:ENGINE}”, który nie jest zatrzymany w hali warsztatów +STR_NEWGRF_BROKEN_CAPACITY :{WHITE}Zmieniono ładowność pojazdu na „{1:ENGINE}”, kiedy nie był w hali warsztatów lub w trakcie przebudowy STR_BROKEN_VEHICLE_LENGTH :{WHITE}Pociąg „{VEHICLE}” należący do „{COMPANY}” ma nieprawidłową długość. Prawdopodobnie jest to spowodowane problemami z NewGRF-ami. Gra może się desychronizować lub zawiesić -STR_NEWGRF_BUGGY :{WHITE}NewGRF '{0:STRING}' dostarcza niepoprawnych danych -STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Informacje o ładunku/naprawie dla '{1:ENGINE}' różnią się od listy zakupu po zbudowaniu. Może to spowodować, że autoodnowienie/-zamiana nie wykona remontu poprawnie -STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' spowodował nieskończoną pętlę w wywołaniu produkcji -STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Wywołanie {1:HEX} zwróciło nieznany/błędny wynik {2:HEX} -STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}'{1:STRING}' zwrócił niewłaściwy typ ładunku w wywołaniu produkcji w {2:HEX} +STR_NEWGRF_BUGGY :{WHITE}NewGRF „{0:STRING}” dostarcza niepoprawne dane +STR_NEWGRF_BUGGY_ARTICULATED_CARGO :{WHITE}Informacje o ładunku/naprawie dla „{1:ENGINE}” różnią się od listy zakupu po zbudowaniu. Może to spowodować, że autoodnowienie/-zamiana nie wykona remontu poprawnie +STR_NEWGRF_BUGGY_ENDLESS_PRODUCTION_CALLBACK :{WHITE}„{1:STRING}” spowodował nieskończoną pętlę w wywołaniu zwrotnym produkcji +STR_NEWGRF_BUGGY_UNKNOWN_CALLBACK_RESULT :{WHITE}Wywołanie zwrotne {1:HEX} zwróciło nieznany/błędny wynik {2:HEX} +STR_NEWGRF_BUGGY_INVALID_CARGO_PRODUCTION_CALLBACK :{WHITE}„{1:STRING}” zwrócił niewłaściwy typ ładunku w wywołaniu zwrotnym produkcji w {2:HEX} # 'User removed essential NewGRFs'-placeholders for stuff without specs STR_NEWGRF_INVALID_CARGO : @@ -5023,7 +5038,7 @@ STR_AI_DEBUG_SELECT_AI_TOOLTIP :{BLACK}Pokaż o STR_AI_GAME_SCRIPT :{BLACK}Game Script STR_AI_GAME_SCRIPT_TOOLTIP :{BLACK}Sprawdź log Game Script -STR_ERROR_AI_NO_AI_FOUND :Nie znaleziono SI do wczytania.{}SI jest nieaktywne i nic nie robi.{}Możesz ściągnąć SI z 'Dodatki Online' w głównym menu gry +STR_ERROR_AI_NO_AI_FOUND :Nie znaleziono SI do wczytania.{}SI jest nieaktywne i nic nie robi.{}Możesz pobrać kilka SI z przeglądarki „Dodatków Online” STR_ERROR_AI_PLEASE_REPORT_CRASH :{WHITE}Jeden z uruchomionych skryptów przestał działać. Prosimy o zgłoszenie tego autorowi skryptu dołączając zrzut ekranu okna debugowania SI / GameScript STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}Okno debugowania SI / Game Script jest dostępne tylko na serwerze @@ -5087,6 +5102,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Spis Treści +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Przeskocz do wybranej sekcji w wyświetlanym pliku za pomocą tej listy +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Cofnij się w historii nawigacji +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Powrót do przodu w historii nawigacji STR_TEXTFILE_WRAP_TEXT :{WHITE}Zawijaj tekst STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Zawiń tekst w oknie, aby zmieścił się bez konieczności przewijania STR_TEXTFILE_VIEW_README :{BLACK}Odczytaj plik „readme” @@ -5097,6 +5117,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} {STRING} - lista zmian STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} {STRING} - licencja STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Podgląd wyniku ankiety +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Dokument OpenTTD „{STRING}” # Vehicle loading indicators @@ -5164,8 +5185,8 @@ STR_WARNING_FALLBACK_SOUNDSET :{WHITE}Znalezio STR_WARNING_SCREENSHOT_SIZE_CAPTION :{WHITE}Ogromny zrzut ekranu STR_WARNING_SCREENSHOT_SIZE_MESSAGE :{YELLOW}Zrzut ekranu będzie miał rozdzielczość {COMMA} x {COMMA} pikseli. Zrzut ekranu może zająć chwilę. Kontynuować? -STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY :{WHITE}Mapa wysokości pomyślnie zapisana jako '{STRING}'. Najwyższy szczyt wynosi {NUM} -STR_MESSAGE_SCREENSHOT_SUCCESSFULLY :{WHITE}Zrzut ekranu zapisany na dysk z powodzeniem '{STRING}' +STR_MESSAGE_HEIGHTMAP_SUCCESSFULLY :{WHITE}Mapa wysokości pomyślnie zapisana jako „{STRING}”. Najwyższy szczyt wynosi {NUM} +STR_MESSAGE_SCREENSHOT_SUCCESSFULLY :{WHITE}Zrzut ekranu zapisany na dysk z powodzeniem „{STRING}” STR_ERROR_SCREENSHOT_FAILED :{WHITE}Błąd zrzutu ekranu! # Error message titles diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index ad2bd47b92..9b83d2d549 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -3401,6 +3401,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Inspecci STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} em {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Objecto STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Tipo de ferrovia +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Tipo de estrada STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Parâmetro da variável 60+x do NewGRF (hexadecimal) diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 9c081b4c27..e811e9e610 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -3575,6 +3575,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Прос STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} в {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Объект STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Тип рельсов +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Тип дороги STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Параметр переменной NewGRF 60+x (шестнадцатеричный) diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index 01ce55bb28..b4b73809cb 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -191,6 +191,23 @@ STR_COLOUR_WHITE :白 色 STR_COLOUR_RANDOM :随机 ###length 17 +STR_COLOUR_SECONDARY_DARK_BLUE :深蓝色 +STR_COLOUR_SECONDARY_PALE_GREEN :浅绿色 +STR_COLOUR_SECONDARY_SECONDARY_PINK :粉色 +STR_COLOUR_SECONDARY_YELLOW :黄 色 +STR_COLOUR_SECONDARY_RED :红 色 +STR_COLOUR_SECONDARY_LIGHT_BLUE :淡蓝色 +STR_COLOUR_SECONDARY_GREEN :绿 色 +STR_COLOUR_SECONDARY_DARK_GREEN :深绿色 +STR_COLOUR_SECONDARY_BLUE :蓝 色 +STR_COLOUR_SECONDARY_CREAM :奶油色 +STR_COLOUR_SECONDARY_MAUVE :深紫色 +STR_COLOUR_SECONDARY_PURPLE :紫 色 +STR_COLOUR_SECONDARY_ORANGE :橘黄色 +STR_COLOUR_SECONDARY_BROWN :棕 色 +STR_COLOUR_SECONDARY_GREY :浅灰色 +STR_COLOUR_SECONDARY_WHITE :白 色 +STR_COLOUR_SECONDARY_SAME_AS_PRIMARY :与主色调相同 # Units used in OpenTTD @@ -198,6 +215,7 @@ STR_UNITS_VELOCITY_IMPERIAL :{DECIMAL}{NBSP} STR_UNITS_VELOCITY_METRIC :{DECIMAL}{NBSP}千米/小时 STR_UNITS_VELOCITY_SI :{DECIMAL}{NBSP}米/秒 STR_UNITS_VELOCITY_GAMEUNITS :{DECIMAL}{NBSP}格/天 +STR_UNITS_VELOCITY_KNOTS :{DECIMAL}{NBSP}节 STR_UNITS_POWER_IMPERIAL :{DECIMAL}{NBSP}匹马力 STR_UNITS_POWER_METRIC :{DECIMAL}{NBSP}匹马力 @@ -346,9 +364,9 @@ STR_GOTO_ORDER_VIEW_TOOLTIP :{BLACK}打开 ###length 31 STR_TOOLBAR_TOOLTIP_PAUSE_GAME :{BLACK}暂停游戏 STR_TOOLBAR_TOOLTIP_FORWARD :{BLACK}快速游戏模式 -STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}选项 -STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}保存游戏、放弃游戏、退出 -STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}显示地图、附加视点或标志列表 +STR_TOOLBAR_TOOLTIP_OPTIONS :{BLACK}选项和设置 +STR_TOOLBAR_TOOLTIP_SAVE_GAME_ABANDON_GAME :{BLACK}保存游戏、读取游戏、放弃游戏、退出 +STR_TOOLBAR_TOOLTIP_DISPLAY_MAP :{BLACK}显示地图、附加视点、客货流或标志列表 STR_TOOLBAR_TOOLTIP_DISPLAY_TOWN_DIRECTORY :{BLACK}显示城镇列表 STR_TOOLBAR_TOOLTIP_DISPLAY_SUBSIDIES :{BLACK}显示财政补贴 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_STATIONS :{BLACK}显示公司所有的车站列表 @@ -356,9 +374,9 @@ STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_FINANCES :{BLACK}显示 STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_GENERAL :{BLACK}显示公司综合信息 STR_TOOLBAR_TOOLTIP_DISPLAY_STORY_BOOK :{BLACK}显示公司历史纪录 STR_TOOLBAR_TOOLTIP_DISPLAY_GOALS_LIST :{BLACK}显示游戏目标选单 -STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}显示图表 +STR_TOOLBAR_TOOLTIP_DISPLAY_GRAPHS :{BLACK}显示图表和货物运费表 STR_TOOLBAR_TOOLTIP_DISPLAY_COMPANY_LEAGUE :{BLACK}显示公司名次表 -STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}工业设施列表/产业链/建立新工业设施 +STR_TOOLBAR_TOOLTIP_FUND_CONSTRUCTION_OF_NEW :{BLACK}查看工业设施或投资工业设施建设 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_TRAINS :{BLACK}显示公司的火车列表。按住 Ctrl 键单击可以切换组群和车辆列表。 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_ROAD_VEHICLES :{BLACK}显示公司的汽车列表。按住 Ctrl 键单击可以切换组群和汽车列表。 STR_TOOLBAR_TOOLTIP_DISPLAY_LIST_OF_COMPANY_SHIPS :{BLACK}显示公司的船只列表。按住 Ctrl 键单击可以切换组群和船只列表。 @@ -372,8 +390,8 @@ STR_TOOLBAR_TOOLTIP_BUILD_SHIP_DOCKS :{BLACK}显示 STR_TOOLBAR_TOOLTIP_BUILD_AIRPORTS :{BLACK}显示机场建设工具 STR_TOOLBAR_TOOLTIP_LANDSCAPING :{BLACK}打开景观美化工具栏{}以修改地形、设置地貌等 STR_TOOLBAR_TOOLTIP_SHOW_SOUND_MUSIC_WINDOW :{BLACK}显示 声音/音乐 控制菜单 -STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}显示最新消息新闻,消息选项,消息历史 -STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}地块信息查询,控制台,脚本调试,截图,关于OpenTTD +STR_TOOLBAR_TOOLTIP_SHOW_LAST_MESSAGE_NEWS :{BLACK}显示最新消息、新闻,消息历史或删除所有消息 +STR_TOOLBAR_TOOLTIP_LAND_BLOCK_INFORMATION :{BLACK}查询地块信息、截图、关于 OpenTTD 和开发者工具 STR_TOOLBAR_TOOLTIP_SWITCH_TOOLBAR :{BLACK}切换工具栏 # Extra tooltips for the scenario editor toolbar @@ -505,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :删除全部消 # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :查询地块信息 +STR_ABOUT_MENU_HELP :帮助和指南 STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :切换到控制台模式 STR_ABOUT_MENU_AI_DEBUG :AI /游戏脚本调试 @@ -606,7 +625,7 @@ STR_GRAPH_OPERATING_PROFIT_CAPTION :{WHITE}利润 STR_GRAPH_INCOME_CAPTION :{WHITE}收入图表 STR_GRAPH_CARGO_DELIVERED_CAPTION :{WHITE}运输的货物总数 STR_GRAPH_COMPANY_PERFORMANCE_RATINGS_CAPTION :{WHITE}公司评价表现指数 (最大指数为1000) -STR_GRAPH_COMPANY_VALUES_CAPTION :{WHITE}公司市值 +STR_GRAPH_COMPANY_VALUES_CAPTION :{WHITE}公司市值图表 STR_GRAPH_CARGO_PAYMENT_RATES_CAPTION :{WHITE}货物运输价格 STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL :{TINY_FONT}{BLACK}运输时间(天) @@ -848,7 +867,7 @@ STR_NEWS_COMPANY_BANKRUPT_TITLE :{BIG_FONT}{BLAC STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION :{BIG_FONT}{BLACK}{STRING} 已经宣布破产,所有资产均已抵债! STR_NEWS_COMPANY_LAUNCH_TITLE :{BIG_FONT}{BLACK}新的运输公司开业大吉! STR_NEWS_COMPANY_LAUNCH_DESCRIPTION :{BIG_FONT}{BLACK}{STRING} 在 {TOWN} 附近开工建设! -STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLACK}{STRING} 被 {STRING} 收购! +STR_NEWS_MERGER_TAKEOVER_TITLE :{BIG_FONT}{BLACK}{STRING} 被 {STRING} 以未知的价格收购 ! STR_PRESIDENT_NAME_MANAGER :{BLACK}{PRESIDENT_NAME}{}(总裁) STR_NEWS_NEW_TOWN :{BLACK}{BIG_FONT}{STRING} 赞助了城镇 {TOWN} 的建设! @@ -933,12 +952,27 @@ STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT :{BLACK}将主 # Game options window STR_GAME_OPTIONS_CAPTION :{WHITE}游戏选项 +STR_GAME_OPTIONS_TAB_GENERAL :通用 +STR_GAME_OPTIONS_TAB_GENERAL_TT :{BLACK}选择通用设定 +STR_GAME_OPTIONS_TAB_GRAPHICS :图形包 +STR_GAME_OPTIONS_TAB_GRAPHICS_TT :{BLACK}选择图形组设定 +STR_GAME_OPTIONS_TAB_SOUND :音效 +STR_GAME_OPTIONS_TAB_SOUND_TT :{BLACK}选择音乐和音效的设定 +STR_GAME_OPTIONS_VOLUME :音量 +STR_GAME_OPTIONS_SFX_VOLUME :音效 +STR_GAME_OPTIONS_MUSIC_VOLUME :音乐 +STR_GAME_OPTIONS_VOLUME_0 :0% +STR_GAME_OPTIONS_VOLUME_25 :25% +STR_GAME_OPTIONS_VOLUME_50 :50% +STR_GAME_OPTIONS_VOLUME_75 :75% +STR_GAME_OPTIONS_VOLUME_100 :100% STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME :{BLACK}货币单位 STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP :{BLACK}货币单位选择 +STR_GAME_OPTIONS_CURRENCY_CODE :{STRING} ({STRING}) ###length 42 STR_GAME_OPTIONS_CURRENCY_GBP :英镑 @@ -990,6 +1024,10 @@ STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_TOOLTIP :{BLACK}选择 # Autosave dropdown ###length 5 STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_OFF :关闭 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_10_MINUTES :每10分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_30_MINUTES :每30分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_60_MINUTES :每60分钟 +STR_GAME_OPTIONS_AUTOSAVE_DROPDOWN_EVERY_120_MINUTES :每120分钟 STR_GAME_OPTIONS_LANGUAGE :{BLACK}语言 STR_GAME_OPTIONS_LANGUAGE_TOOLTIP :{BLACK}选择界面语言 @@ -1026,6 +1064,13 @@ STR_GAME_OPTIONS_GUI_SCALE_3X :3倍 STR_GAME_OPTIONS_GUI_SCALE_4X :4倍 STR_GAME_OPTIONS_GUI_SCALE_5X :5倍 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_FRAME :{BLACK}自动体验调查 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY :{BLACK}参与自动体验调查 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_TOOLTIP :{BLACK}“打开”时, OpenTTD会在结束游戏时传输调查结果 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK :{BLACK}关于体验调查和隐私 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_LINK_TOOLTIP :{BLACK}这会提供更多自动体验调查的信息(打开浏览器) +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW :{BLACK}预览调查结果 +STR_GAME_OPTIONS_PARTICIPATE_SURVEY_PREVIEW_TOOLTIP :{BLACK}展示正在运行的存档的调查结果 STR_GAME_OPTIONS_GRAPHICS :{BLACK}图像 @@ -1035,12 +1080,12 @@ STR_GAME_OPTIONS_REFRESH_RATE_ITEM :{NUM}Hz STR_GAME_OPTIONS_REFRESH_RATE_WARNING :{WHITE}高于 60Hz 的刷新率可能会影响性能。 STR_GAME_OPTIONS_BASE_GRF :{BLACK}基础图形组 -STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}选择要使用的基础图形组 +STR_GAME_OPTIONS_BASE_GRF_TOOLTIP :{BLACK}选择要使用的基础图形组(只能在主菜单更改,不能在游戏中更改) STR_GAME_OPTIONS_BASE_GRF_STATUS :{RED}{NUM} 文件{}未找到或不正确 STR_GAME_OPTIONS_BASE_GRF_DESCRIPTION_TOOLTIP :{BLACK}关于基本图组的额外信息 STR_GAME_OPTIONS_BASE_SFX :{BLACK}基础音效组 -STR_GAME_OPTIONS_BASE_SFX_TOOLTIP :{BLACK}选择要使用的基础音效组 +STR_GAME_OPTIONS_BASE_SFX_TOOLTIP :{BLACK}选择要使用的基础音效组(只能在主菜单更改,不能在游戏中更改) STR_GAME_OPTIONS_BASE_SFX_DESCRIPTION_TOOLTIP :{BLACK}有关基础音效组的附加信息 STR_GAME_OPTIONS_BASE_MUSIC :{BLACK}基础音乐组 @@ -1156,6 +1201,7 @@ STR_CONFIG_SETTING_EXPAND_ALL :{BLACK}展开 STR_CONFIG_SETTING_COLLAPSE_ALL :{BLACK}关闭全部 STR_CONFIG_SETTING_RESET_ALL :{BLACK}重置所有值 STR_CONFIG_SETTING_NO_EXPLANATION_AVAILABLE_HELPTEXT :(没有可用的提示) +STR_CONFIG_SETTING_VALUE :{PUSH_COLOUR}{ORANGE}{STRING}{POP_COLOUR} STR_CONFIG_SETTING_DEFAULT_VALUE :{LTBLUE}默认值: {ORANGE}{STRING} STR_CONFIG_SETTING_TYPE :{LTBLUE}设置类型: {ORANGE}{STRING} STR_CONFIG_SETTING_TYPE_CLIENT :当前客户端设置(不保存,影响所有游戏) @@ -1209,6 +1255,7 @@ STR_CONFIG_SETTING_HORIZONTAL_POS_LEFT :左侧 STR_CONFIG_SETTING_HORIZONTAL_POS_CENTER :中央 STR_CONFIG_SETTING_HORIZONTAL_POS_RIGHT :右侧 +STR_CONFIG_SETTING_SECONDS_VALUE :{COMMA}{NBSP}秒 STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN :最大初始贷款: {STRING} STR_CONFIG_SETTING_MAXIMUM_INITIAL_LOAN_HELPTEXT :公司最大贷款额(不考虑通货膨胀的影响) @@ -1337,7 +1384,7 @@ STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT :新的调度命 STR_CONFIG_SETTING_NONSTOP_BY_DEFAULT_HELPTEXT :通常,车辆在它经过的每一个车站都会停车。“打开”本选项时,车辆会不停车的通过所有中间车站前往最终目的地。注意:这只是为每一条新调度命令设置一个默认信息,仍然可以为每条调度命令设置明确的信息 STR_CONFIG_SETTING_STOP_LOCATION :新列车调度计划中默认命令为停靠在站台{STRING} 位置 -STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :设置车辆在站台的默认停靠位置,“近端”是靠近车辆进入的那一端,“中间”是站台中间位置,“远端”是远离车辆进入的那一端 +STR_CONFIG_SETTING_STOP_LOCATION_HELPTEXT :设置车辆在站台的默认停靠位置,“近端”是靠近车辆进入的那一端,“中间”是站台中间位置,“远端”是远离车辆进入的那一端。注意:本设定只改变新指令的默认设定。玩家仍可通过点击指令文字改变列车在某车站的停车位置。 ###length 3 STR_CONFIG_SETTING_STOP_LOCATION_NEAR_END :近端 STR_CONFIG_SETTING_STOP_LOCATION_MIDDLE :中间 @@ -1380,6 +1427,8 @@ STR_CONFIG_SETTING_PLANE_CRASHES_NONE :不出现* STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :较少出现 STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :正常 +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR :允许在竞争对手所属的道路或铁路上建平交道口: {STRING} +STR_CONFIG_SETTING_CROSSING_WITH_COMPETITOR_HELPTEXT :“打开”时,允许在竞争对手所属的道路上建平交道口 STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :允许在城镇所属的道路上建通过式车站: {STRING} STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD_HELPTEXT :“打开”时允许在城市所属的道路上建设通过式车站 @@ -1393,6 +1442,8 @@ STR_CONFIG_SETTING_INFRASTRUCTURE_MAINTENANCE_HELPTEXT :固定资产会 STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR :初创公司颜色:{STRING} STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_HELPTEXT :选定公司的初始配色方案 +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY :公司初始副色调: {STRING} +STR_CONFIG_SETTING_COMPANY_STARTING_COLOUR_SECONDARY_HELPTEXT :如果正在使用的NewGRF允许,选定一个公司初始副色调。 STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS :总允许建设小型机场: {STRING} STR_CONFIG_SETTING_NEVER_EXPIRE_AIRPORTS_HELPTEXT :“打开”此选项,每种类型机场出现后一直是可用的 @@ -1537,7 +1588,7 @@ STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREY_TO_RED :灰色到红色 STR_CONFIG_SETTING_LINKGRAPH_COLOURS_GREYSCALE :灰度 STR_CONFIG_SETTING_SCROLLMODE :视点滚动方式:{STRING} -STR_CONFIG_SETTING_SCROLLMODE_HELPTEXT :滚动地图的行为 +STR_CONFIG_SETTING_SCROLLMODE_HELPTEXT :用鼠标拖动地图时的行为。“鼠标位置锁定”选项并不在任何平台上适用,如基于网页的版本、触屏、Linux 上的 Wayland等 ###length 4 STR_CONFIG_SETTING_SCROLLMODE_DEFAULT :鼠标右键移动视角,鼠标指针不跟随移动 STR_CONFIG_SETTING_SCROLLMODE_RMB_LOCKED :鼠标右键移动地图,鼠标指针不跟随移动 @@ -1595,6 +1646,9 @@ STR_CONFIG_SETTING_RIGHT_MOUSE_BTN_EMU_OFF :关闭 STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE :右键关闭窗口: {STRING} STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_HELPTEXT :使用在窗口内按右键关闭该窗口,本功能与右键工具提示不能共存! ###length 3 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_NO :否 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES :是 +STR_CONFIG_SETTING_RIGHT_MOUSE_WND_CLOSE_YES_EXCEPT_STICKY :是(非粘滞) STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES :使用 {STRING} 形式的文件名存档 STR_CONFIG_SETTING_DATE_FORMAT_IN_SAVE_NAMES_HELPTEXT :游戏存档文件名中日期的格式 @@ -1716,7 +1770,7 @@ STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_HELPTEXT :单个脚本强 STR_CONFIG_SETTING_SCRIPT_MAX_MEMORY_VALUE :{COMMA} MiB STR_CONFIG_SETTING_SERVINT_ISPERCENT :保养周期(百分数): {STRING} -STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :选择触发车辆保养的条件,距离上一次保养的时间或者与最高可靠性的百分比 +STR_CONFIG_SETTING_SERVINT_ISPERCENT_HELPTEXT :“打开”时,当车辆的可靠性降到他们最大可靠性的一定百分比时,他们会去保养。{}{}例如,如果一辆车的最大可靠性是90%,而保养间隔是20%,车辆会在可靠性为72%时去保养。 STR_CONFIG_SETTING_SERVINT_TRAINS :火车默认保养周期:{STRING} STR_CONFIG_SETTING_SERVINT_TRAINS_HELPTEXT :如果没有为火车直接指定保养周期,设定默认火车保养周期 @@ -1846,8 +1900,8 @@ STR_CONFIG_SETTING_ALLOW_TOWN_ROADS_HELPTEXT :“打开”时 STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS :允许城镇建设平交道: {STRING} STR_CONFIG_SETTING_ALLOW_TOWN_LEVEL_CROSSINGS_HELPTEXT :“打开”时允许城镇建设平交路口 -STR_CONFIG_SETTING_NOISE_LEVEL :允许城镇控制机场噪音: {STRING} -STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :“关闭”本选项时,每个城镇可以建设两个机场,“打开”时,可以建设的机场数目取决于城市对噪音的忍耐度,而这与城市人口、机场规模和距离有关 +STR_CONFIG_SETTING_NOISE_LEVEL :基于噪音级别控制机场建设: {STRING} +STR_CONFIG_SETTING_NOISE_LEVEL_HELPTEXT :允许城镇基于城镇人口、机场大小和距离控制机场噪音。“关闭”时,每个城市只允许建设两座机场,除非地方政府态度被设为“宽容的” STR_CONFIG_SETTING_TOWN_FOUNDING :在游戏中建立城镇: {STRING} STR_CONFIG_SETTING_TOWN_FOUNDING_HELPTEXT :“打开”本选项时,允许玩家在游戏中创建新城镇 @@ -1921,6 +1975,10 @@ STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :没有 STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER :初始城市规模因子:{STRING} STR_CONFIG_SETTING_CITY_SIZE_MULTIPLIER_HELPTEXT :游戏开局时,城市的平均规模相对于普通城镇的比值 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL :每 {STRING} 更新货物分配 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_INTERVAL_HELPTEXT :两次连结图的重新计算间隔。每次重新计算会计算图中一个部分的计划。这意味着填入的值X不意味着整张图会每X秒更新一次,只有其中的一部分会被更新。此设定赋值越小,则更多的CPU时间会被用来重新计算。此设定赋值越大,则在线路改变时货物再分配所需时间会变长。 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME :花费 {STRING} 在货物分配的重新计算上 +STR_CONFIG_SETTING_LINKGRAPH_RECALC_TIME_HELPTEXT :每一个连结图的重新计算时间。当一次重新计算开始,一个线程会被允许运行这个秒数。此设定赋值越小,则线程无法按时结束的可能性越大,从而导致游戏运行延迟。此设定赋值越大,则在线路改变时货物再分配所需时间会变长。 STR_CONFIG_SETTING_DISTRIBUTION_PAX :乗客分配方式:{STRING} STR_CONFIG_SETTING_DISTRIBUTION_PAX_HELPTEXT :假设有交通路线连接甲、乙两站。“对称”指甲站往乙站的乗客数量与乙站往甲站的乘客数量大致相同。“不对称”指任何一站往另一站的乘客数量皆由系统随意决定。“手动”指系统不会自动分配乘客的目的地。 @@ -1946,13 +2004,15 @@ STR_CONFIG_SETTING_DEMAND_SIZE_HELPTEXT :如果把此设 STR_CONFIG_SETTING_SHORT_PATH_SATURATION :如果最短路径的饱和度超过{STRING},把货物改派往容量较大的路径 STR_CONFIG_SETTING_SHORT_PATH_SATURATION_HELPTEXT :货物分配功能在派送货物时,会优先使用最短路径,当它饱和后改用第二短的路径,如此类推。当所有路径皆饱和但仍未满足需求,系统會由容量较大的路径开始继续加载货物。{}由于路径饱和度难以准确估算,此设定容许您定义一值,使短路径达到该饱和度后,系统便开始加载容量较大的路径。{}如果此设定的值少於100%,就算系统高估路径容量,也不會使过多的货物滞留在站台上。 -STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位:{STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY :速度单位(陆地):{STRING} +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_NAUTICAL :速度单位 (航海): {STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_HELPTEXT :在界面上以所选择的单位表示速度 ###length 5 STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_IMPERIAL :英制(英里/小时) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_METRIC :公制(千米/小时) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_SI :国际单位制(米/秒) STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_GAMEUNITS :游戏单位 (格/日) +STR_CONFIG_SETTING_LOCALISATION_UNITS_VELOCITY_KNOTS :节 STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER :运输工具功率单位:{STRING} STR_CONFIG_SETTING_LOCALISATION_UNITS_POWER_HELPTEXT :在界面上以所选择的单位表示运输工具的功率 @@ -2051,6 +2111,7 @@ STR_CONFIG_ERROR_SPRITECACHE_TOO_BIG :{WHITE}无法 # Video initalization errors STR_VIDEO_DRIVER_ERROR :{WHITE}图形设置错误… STR_VIDEO_DRIVER_ERROR_NO_HARDWARE_ACCELERATION :{WHITE}… 找不到合适的 GPU。硬件加速已禁用 +STR_VIDEO_DRIVER_ERROR_HARDWARE_ACCELERATION_CRASH :{WHITE}... GPU使游戏崩溃了。硬件加速已禁用 # Intro window STR_INTRO_CAPTION :{WHITE}OpenTTD {REV} @@ -2064,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}联机 STR_INTRO_GAME_OPTIONS :{BLACK}游戏选项 STR_INTRO_HIGHSCORE :{BLACK}高分榜 +STR_INTRO_HELP :{BLACK}帮助和指南 STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}设置 STR_INTRO_NEWGRF_SETTINGS :{BLACK}NewGRF 设置 STR_INTRO_ONLINE_CONTENT :{BLACK}在线查找扩展包 @@ -2085,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}选择 STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}显示游戏选项 STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}显示高分榜 +STR_INTRO_TOOLTIP_HELP :{BLACK}获取说明和在线资源 STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}显示设置 STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}显示GRF设定 STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}连接服务器并查找扩展包 @@ -2107,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}你确 STR_ABANDON_SCENARIO_QUERY :{YELLOW}你确定要退出当前场景吗? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}帮助和指南 +STR_HELP_WINDOW_WEBSITES :{BLACK}网页 +STR_HELP_WINDOW_DOCUMENTS :{BLACK}文档 +STR_HELP_WINDOW_README :{BLACK}查看说明 +STR_HELP_WINDOW_CHANGELOG :{BLACK}更新日志 +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}已知漏洞 +STR_HELP_WINDOW_LICENSE :{BLACK}许可证 +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}手册 / 百科 +STR_HELP_WINDOW_BUGTRACKER :{BLACK}反馈游戏漏洞 +STR_HELP_WINDOW_COMMUNITY :{BLACK}社区 # Cheat window STR_CHEATS :{WHITE}作弊 @@ -2355,6 +2429,7 @@ STR_NETWORK_CLIENT_LIST_NEW_COMPANY :(新公司) STR_NETWORK_CLIENT_LIST_NEW_COMPANY_TOOLTIP :{BLACK}新建并加入公司 STR_NETWORK_CLIENT_LIST_PLAYER_ICON_SELF_TOOLTIP :{BLACK}这是你 STR_NETWORK_CLIENT_LIST_PLAYER_ICON_HOST_TOOLTIP :{BLACK}这里是游戏的主机 +STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT :{BLACK}{NUM}个客户端 {NUM}/{NUM}所公司 STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT_TOOLTIP :{BLACK}服务器管理员允许的当前连接的玩家数量、公司数量和最多公司数量 # Matches ConnectionType @@ -2382,6 +2457,12 @@ STR_NETWORK_ASK_RELAY_NO :{BLACK}否 STR_NETWORK_ASK_RELAY_YES_ONCE :{BLACK}是,本次请求 STR_NETWORK_ASK_RELAY_YES_ALWAYS :{BLACK}是,不要再次询问 +STR_NETWORK_ASK_SURVEY_CAPTION :是否参与自动调查? +STR_NETWORK_ASK_SURVEY_TEXT :您是否愿意参与自动体验调查?{} OpenTTD 会在结束游戏时传输调查结果。{} 您可以在任意时刻在“游戏选项”菜单修改本选项。 +STR_NETWORK_ASK_SURVEY_PREVIEW :预览调查结果 +STR_NETWORK_ASK_SURVEY_LINK :关于体验调查和隐私 +STR_NETWORK_ASK_SURVEY_NO :否 +STR_NETWORK_ASK_SURVEY_YES :是 STR_NETWORK_SPECTATORS :旁观者 @@ -2588,6 +2669,7 @@ STR_TRANSPARENT_BUILDINGS_TOOLTIP :{BLACK}调整 STR_TRANSPARENT_BRIDGES_TOOLTIP :{BLACK}调整桥梁是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_STRUCTURES_TOOLTIP :{BLACK}调整灯塔及信号发射塔是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_CATENARY_TOOLTIP :{BLACK}调整电气铁路电线是否为透明{}CTRL+点击 锁定 +STR_TRANSPARENT_TEXT_TOOLTIP :{BLACK}调整装卸提示和盈亏提示是否为透明{}CTRL+点击 锁定 STR_TRANSPARENT_INVISIBLE_TOOLTIP :{BLACK}选择设置为:不显示或透明 # Linkgraph legend window @@ -2671,8 +2753,11 @@ STR_STATION_BUILD_DRAG_DROP_TOOLTIP :{BLACK}使用 STR_STATION_BUILD_STATION_CLASS_TOOLTIP :{BLACK}选择一个要显示车站类型 STR_STATION_BUILD_STATION_TYPE_TOOLTIP :{BLACK}选择要建造的车站类型 -STR_STATION_CLASS_DFLT :默认车站 +STR_STATION_CLASS_DFLT :默认 +STR_STATION_CLASS_DFLT_STATION :默认车站 +STR_STATION_CLASS_DFLT_ROADSTOP :默认道路站点 STR_STATION_CLASS_WAYP :路标 +STR_STATION_CLASS_WAYP_WAYPOINT :默认路点 # Signal window STR_BUILD_SIGNAL_CAPTION :{WHITE}信号灯 @@ -2896,14 +2981,14 @@ STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_CAPTION :{WHITE}移除 STR_FUND_INDUSTRY_REMOVE_ALL_INDUSTRIES_QUERY :{YELLOW}你确定要清除所有工业吗? # Industry cargoes window -STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION :{WHITE}{STRING} 的产业链 -STR_INDUSTRY_CARGOES_CARGO_CAPTION :{WHITE}{STRING} 的产业链 +STR_INDUSTRY_CARGOES_INDUSTRY_CAPTION :{WHITE}产业链- {STRING} +STR_INDUSTRY_CARGOES_CARGO_CAPTION :{WHITE}货物的产业链 - {STRING} STR_INDUSTRY_CARGOES_PRODUCERS :{WHITE}供应商 STR_INDUSTRY_CARGOES_CUSTOMERS :{WHITE}采购商 STR_INDUSTRY_CARGOES_HOUSES :{WHITE}房屋 STR_INDUSTRY_CARGOES_INDUSTRY_TOOLTIP :{BLACK}点击查看上下游产业链 STR_INDUSTRY_CARGOES_CARGO_TOOLTIP :{BLACK}{STRING}{}点该货物可显示其上下游工业 -STR_INDUSTRY_DISPLAY_CHAIN :{BLACK}显示产业链 +STR_INDUSTRY_DISPLAY_CHAIN :{BLACK}产业链 STR_INDUSTRY_DISPLAY_CHAIN_TOOLTIP :{BLACK}显示货物的上下游工业 STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP :{BLACK}在缩略地图显示 STR_INDUSTRY_CARGOES_NOTIFY_SMALLMAP_TOOLTIP :{BLACK}将该产业链的工业显示在缩略地图中 @@ -3315,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}检查 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} at {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :物件 STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :铁路类型 +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :道路类型 STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGRF variable 60+x 参数 (十六进制) @@ -3349,6 +3435,7 @@ STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING STR_NEWGRF_ERROR_MSG_WARNING :{RED}警告:{SILVER}{STRING} STR_NEWGRF_ERROR_MSG_ERROR :{RED}错误:{SILVER}{STRING} STR_NEWGRF_ERROR_MSG_FATAL :{RED}严重错误:{SILVER}{STRING} +STR_NEWGRF_ERROR_FATAL_POPUP :{WHITE}NewGRF "{STRING}" 发生了严重错误:{}{STRING} STR_NEWGRF_ERROR_POPUP :{WHITE}NewGRF "{STRING}"发生了一个错误:{}{STRING} STR_NEWGRF_ERROR_VERSION_NUMBER :{1:STRING} 不能与 OpenTTD 报告的 TTDPatch 版本兼容。 STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{1:STRING} 是为 {2:STRING} 版 TTD 开发的。 @@ -3497,8 +3584,8 @@ STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_LARGE_ADVERTISING :{PUSH_COLOUR}{Y STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_ROAD_RECONSTRUCTION :{PUSH_COLOUR}{YELLOW}资助市政道路进行重建。{}将造成市内交通阻断 6 个月。{}{POP_COLOUR}费用:{CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_STATUE_OF_COMPANY :{PUSH_COLOUR}{YELLOW}以公司的名义设立一尊塑像。{}为位于该城镇的车站提供永久的评分增益。{}{POP_COLOUR}费用:{CURRENCY_LONG} STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_NEW_BUILDINGS :{PUSH_COLOUR}{YELLOW}资助市内建设新的商业设施。{}为城镇提供暂时的成长速度增益。{}{POP_COLOUR}费用:{CURRENCY_LONG} -STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT :{PUSH_COLOUR}{YELLOW}购买该市一年的运输专营权。{}其间该市的乘客及货物只允许选用贵公司的运输服务。{}{POP_COLOUR}费用:{CURRENCY_LONG} -STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{PUSH_COLOUR}{YELLOW}贿赂地方政府以提高评价,但有被发现后严厉惩罚的风险。{}{POP_COLOUR}费用:{CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT :{PUSH_COLOUR}{YELLOW}购买该市一年的运输专营权。{}其间该市的乘客及货物只允许选用贵公司的运输服务。若竞争对手对该市的贿赂成功,此合同将被取消。{}{POP_COLOUR}费用:{CURRENCY_LONG} +STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE :{PUSH_COLOUR}{YELLOW}贿赂地方政府以提高评价,并终止竞争者的运输专营权,但有被发现后严厉惩罚的风险。{}{POP_COLOUR}费用:{CURRENCY_LONG} # Goal window STR_GOALS_CAPTION :{WHITE}{COMPANY} 目标 @@ -3720,6 +3807,8 @@ STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON :{BLACK}固定 STR_COMPANY_VIEW_INFRASTRUCTURE_TOOLTIP :{BLACK}显示详细的设施情况 STR_COMPANY_VIEW_GIVE_MONEY_BUTTON :{BLACK}给予资金 STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP :{BLACK}给予该公司资金 +STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON :{BLACK}不受其欢迎的收购 +STR_COMPANY_VIEW_HOSTILE_TAKEOVER_TOOLTIP :{BLACK}对此公司进行不受其欢迎的收购 STR_COMPANY_VIEW_NEW_FACE_BUTTON :{BLACK}新的头像 STR_COMPANY_VIEW_NEW_FACE_TOOLTIP :{BLACK}为总裁选择新头像 @@ -3735,6 +3824,7 @@ STR_COMPANY_VIEW_PRESIDENT_S_NAME_QUERY_CAPTION :总裁姓名 STR_COMPANY_VIEW_GIVE_MONEY_QUERY_CAPTION :输入你要给予的金额 STR_BUY_COMPANY_MESSAGE :{WHITE}我们正在寻找一家愿意收购我们的公司。{}{}您愿意收购 {COMPANY} ({CURRENCY_LONG}) 吗? +STR_BUY_COMPANY_HOSTILE_TAKEOVER :{WHITE}当不受其欢迎地收购 {COMPANY} 时,您会买下其所有的资产,还清其所有的债务,并支付其两年的利润。{}{}总价预计为 {CURRENCY_LONG}.{}{}您想继续此收购吗? # Company infrastructure window STR_COMPANY_INFRASTRUCTURE_VIEW_CAPTION :{WHITE}{COMPANY} 的设施 @@ -3806,7 +3896,10 @@ STR_VEHICLE_LIST_MANAGE_LIST :{BLACK}管理 STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP :{BLACK}向所有在此列表中的运输工具发出指令 STR_VEHICLE_LIST_REPLACE_VEHICLES :替换车辆/飞机/船只 STR_VEHICLE_LIST_SEND_FOR_SERVICING :进行保养 +STR_VEHICLE_LIST_CREATE_GROUP :创建分组 STR_VEHICLE_LIST_PROFIT_THIS_YEAR_LAST_YEAR :{TINY_FONT}{BLACK}今年利润:{CURRENCY_LONG} (去年利润:{CURRENCY_LONG}) +STR_VEHICLE_LIST_CARGO :[{CARGO_LIST}] +STR_VEHICLE_LIST_NAME_AND_CARGO :{STRING} {STRING} STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT :前往列车车库 STR_VEHICLE_LIST_SEND_ROAD_VEHICLE_TO_DEPOT :前往汽车车库 @@ -4517,7 +4610,7 @@ STR_TIMETABLE_CLEAR_SPEED :{BLACK}取消 STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}清除高亮调度命令的最高限速。按住 Ctrl 键单击可以清除所有命令的最高限速 STR_TIMETABLE_RESET_LATENESS :{BLACK}清除晚点计数器 -STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}重置晚点计数器,从而使车辆准时到达 +STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}重置晚点计数器,从而使车辆被视为准时到达。CTRL+点击会重置全分组的计数器,从而使晚点最多的载具被视为准点而其他被视为早点 STR_TIMETABLE_AUTOFILL :{BLACK}自动填充 STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}根据下一次运行的时间自动填充时间表。按住Ctrl单击可保持等候时间 @@ -4526,6 +4619,8 @@ STR_TIMETABLE_EXPECTED :{BLACK}预期 STR_TIMETABLE_SCHEDULED :{BLACK}表定时间 STR_TIMETABLE_EXPECTED_TOOLTIP :{BLACK}切换显示(根据实际情况计算的)预期时间或表定时间 +STR_TIMETABLE_ARRIVAL :A: {COLOUR}{DATE_TINY} +STR_TIMETABLE_DEPARTURE :D: {COLOUR}{DATE_TINY} # Date window (for timetable) @@ -4562,14 +4657,16 @@ STR_ERROR_AI_PLEASE_REPORT_CRASH :{WHITE}您使 STR_ERROR_AI_DEBUG_SERVER_ONLY :{YELLOW}AI调试窗口只对服务器可用 # AI configuration window -STR_AI_CONFIG_CAPTION_AI :{WHITE}AI配置 -STR_AI_CONFIG_CAPTION_GAMESCRIPT :{WHITE}游戏脚本配置 +STR_AI_CONFIG_CAPTION_AI :{WHITE}AI 设置 +STR_AI_CONFIG_CAPTION_GAMESCRIPT :{WHITE}游戏脚本设定 STR_AI_CONFIG_GAMELIST_TOOLTIP :{BLACK}下局游戏将启用这些脚本 STR_AI_CONFIG_AILIST_TOOLTIP :{BLACK}下局游戏将启用这些AI STR_AI_CONFIG_HUMAN_PLAYER :玩家 STR_AI_CONFIG_RANDOM_AI :随机 AI STR_AI_CONFIG_NONE :(无) +STR_AI_CONFIG_NAME_VERSION :{STRING} {YELLOW}v{NUM} STR_AI_CONFIG_MAX_COMPETITORS :{LTBLUE}最大竞争对手个数:{ORANGE}{COMMA} +STR_AI_CONFIG_COMPETITORS_INTERVAL :{LTBLUE}竞争对手公司建立间隔: {ORANGE}{COMMA} 分钟 STR_AI_CONFIG_MOVE_UP :{BLACK}上移 STR_AI_CONFIG_MOVE_UP_TOOLTIP :{BLACK}在列表中将选择的AI上移 @@ -4582,7 +4679,7 @@ STR_AI_CONFIG_AI :{SILVER}AI STR_AI_CONFIG_CHANGE_AI :{BLACK}选择 AI STR_AI_CONFIG_CHANGE_GAMESCRIPT :{BLACK}选择游戏脚本 -STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}装在另一脚本 +STR_AI_CONFIG_CHANGE_TOOLTIP :{BLACK}载入另一脚本。CTRL+点击以显示所有可用版本 STR_AI_CONFIG_CONFIGURE :{BLACK}设定 STR_AI_CONFIG_CONFIGURE_TOOLTIP :{BLACK}设定脚本参数 @@ -4619,6 +4716,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}目录 +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}通过此列表快速访问想要查看的页面 +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}退回到定位历史 +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}取消定位历史撤回 STR_TEXTFILE_WRAP_TEXT :{WHITE}強迫文字换行 STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}強迫宽于窗格的內文自动换行 STR_TEXTFILE_VIEW_README :{BLACK}查看说明 @@ -4628,6 +4730,8 @@ STR_TEXTFILE_VIEW_LICENCE :{BLACK}版权 STR_TEXTFILE_README_CAPTION :{WHITE}{STRING} {STRING} 的说明 STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}{STRING} {STRING} 的更新日志 STR_TEXTFILE_LICENCE_CAPTION :{WHITE}{STRING} {STRING} 的版权信息 +STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}预览调查结果 +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}OpenTTD 文档 '{STRING}' # Vehicle loading indicators @@ -4810,7 +4914,7 @@ STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}汽车 STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}距离另一码头过近 STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}距离另一机场过近 STR_ERROR_CAN_T_RENAME_STATION :{WHITE}不能重命名车站 -STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD :{WHITE}这是一条城镇所属的道路 +STR_ERROR_DRIVE_THROUGH_ON_TOWN_ROAD :{WHITE}... 城镇所有的道路 STR_ERROR_DRIVE_THROUGH_DIRECTION :{WHITE}道路方向不对 STR_ERROR_DRIVE_THROUGH_CORNER :{WHITE}... 途中型车站不能建在转角处 STR_ERROR_DRIVE_THROUGH_JUNCTION :{WHITE}... 不能在岔路口修建过路型站台 @@ -5069,6 +5173,7 @@ STR_ERROR_AIRCRAFT_NOT_ENOUGH_RANGE :{WHITE}... 飞 # Extra messages which go on the third line of errors, explaining why orders failed STR_ERROR_NO_RAIL_STATION :{WHITE}没有火车站 STR_ERROR_NO_BUS_STATION :{WHITE}没有公交车站 +STR_ERROR_NO_TRUCK_STATION :{WHITE}没有货车站 STR_ERROR_NO_DOCK :{WHITE}这里没有码头 STR_ERROR_NO_AIRPORT :{WHITE}没有机场/直升机场 STR_ERROR_NO_STOP_COMPATIBLE_ROAD_TYPE :{WHITE}没有兼容此道路类型的站点 @@ -5077,11 +5182,13 @@ STR_ERROR_NO_STOP_ARTICULATED_VEHICLE :{WHITE}没有 STR_ERROR_AIRPORT_NO_PLANES :{WHITE}这架飞机不能降落在这个直升机场 STR_ERROR_AIRPORT_NO_HELICOPTERS :{WHITE}这架直升机不能降落在这个机场 STR_ERROR_NO_RAIL_WAYPOINT :{WHITE}没有铁路路点 +STR_ERROR_NO_BUOY :{WHITE}没有浮标 # Timetable related errors STR_ERROR_CAN_T_TIMETABLE_VEHICLE :{WHITE}不能给车辆编制时间表… STR_ERROR_TIMETABLE_ONLY_WAIT_AT_STATIONS :{WHITE}车辆只能在站内等候。 STR_ERROR_TIMETABLE_NOT_STOPPING_HERE :{WHITE}此车辆将不停靠本站。 +STR_ERROR_TIMETABLE_INCOMPLETE :{WHITE}... 时间表不完整 # Sign related errors STR_ERROR_TOO_MANY_SIGNS :{WHITE}……标志太多了 @@ -5561,17 +5668,21 @@ STR_VEHICLE_NAME :{VEHICLE} STR_WAYPOINT_NAME :{WAYPOINT} STR_JUST_CARGO :{CARGO_LONG} +STR_JUST_RIGHT_ARROW :{RIGHT_ARROW} STR_JUST_CHECKMARK :{CHECKMARK} STR_JUST_COMMA :{COMMA} STR_JUST_CURRENCY_SHORT :{CURRENCY_SHORT} STR_JUST_CURRENCY_LONG :{CURRENCY_LONG} STR_JUST_CARGO_LIST :{CARGO_LIST} +STR_JUST_DECIMAL :{DECIMAL} STR_JUST_INT :{NUM} STR_JUST_DATE_TINY :{DATE_TINY} STR_JUST_DATE_SHORT :{DATE_SHORT} STR_JUST_DATE_LONG :{DATE_LONG} STR_JUST_DATE_ISO :{DATE_ISO} STR_JUST_STRING :{STRING} +STR_JUST_STRING1 :{STRING} +STR_JUST_STRING2 :{STRING} STR_JUST_STRING_STRING :{STRING}{STRING} STR_JUST_RAW_STRING :{STRING} STR_JUST_BIG_RAW_STRING :{BIG_FONT}{STRING} diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 0d54733222..28626fba82 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -523,6 +523,7 @@ STR_NEWS_MENU_DELETE_ALL_MESSAGES :Xoá tất cả # About menu ###length 11 STR_ABOUT_MENU_LAND_BLOCK_INFO :Thông tin vùng đất +STR_ABOUT_MENU_HELP :Trợ giúp & hướng dẫn STR_ABOUT_MENU_SEPARATOR : STR_ABOUT_MENU_TOGGLE_CONSOLE :Bật/tắt bảng lệnh STR_ABOUT_MENU_AI_DEBUG :Gỡ rối AI / Game script @@ -2124,6 +2125,7 @@ STR_INTRO_MULTIPLAYER :{BLACK}Nhiều STR_INTRO_GAME_OPTIONS :{BLACK}Cấu Hình Trò Chơi STR_INTRO_HIGHSCORE :{BLACK}Bảng điểm chơi cao nhất +STR_INTRO_HELP :{BLACK}Trợ giúp & hướng dẫn STR_INTRO_CONFIG_SETTINGS_TREE :{BLACK}Thiết lập STR_INTRO_NEWGRF_SETTINGS :{BLACK}Thiết Lập NewGRF STR_INTRO_ONLINE_CONTENT :{BLACK}Các Nội Dung Trên Mạng @@ -2145,6 +2147,7 @@ STR_INTRO_TOOLTIP_TOYLAND_LANDSCAPE :{BLACK}Chọn k STR_INTRO_TOOLTIP_GAME_OPTIONS :{BLACK}Hiển thị cấu hình của trò chơi STR_INTRO_TOOLTIP_HIGHSCORE :{BLACK}Hiện bảng điểm chơi cao nhất +STR_INTRO_TOOLTIP_HELP :{BLACK}Truy cập vào tài liệu và tài nguyên trực tuyến STR_INTRO_TOOLTIP_CONFIG_SETTINGS_TREE :{BLACK}Thiết lập hiển thị STR_INTRO_TOOLTIP_NEWGRF_SETTINGS :{BLACK}Hiển thị tùy chỉnh NewGRF STR_INTRO_TOOLTIP_ONLINE_CONTENT :{BLACK}Kiểm tra những nội dung mới & cập nhật để tải về @@ -2167,6 +2170,17 @@ STR_ABANDON_GAME_QUERY :{YELLOW}Bạn c STR_ABANDON_SCENARIO_QUERY :{YELLOW}Bạn có chắc bạn muốn bỏ màn chơi kịch bản này? # Help window +STR_HELP_WINDOW_CAPTION :{WHITE}Trợ giúp & hướng dẫn +STR_HELP_WINDOW_WEBSITES :{BLACK}Websites +STR_HELP_WINDOW_DOCUMENTS :{BLACK}Tài liệu +STR_HELP_WINDOW_README :{BLACK}Readme +STR_HELP_WINDOW_CHANGELOG :{BLACK}Lịch sử thay đổi +STR_HELP_WINDOW_KNOWN_BUGS :{BLACK}Các lỗi đã biết +STR_HELP_WINDOW_LICENSE :{BLACK}Giấy phép +STR_HELP_WINDOW_MAIN_WEBSITE :{BLACK}OpenTTD +STR_HELP_WINDOW_MANUAL_WIKI :{BLACK}Hướng dẫn / Wiki +STR_HELP_WINDOW_BUGTRACKER :{BLACK}Báo cáo lỗi +STR_HELP_WINDOW_COMMUNITY :{BLACK}Cộng đồng # Cheat window STR_CHEATS :{WHITE}Cheats @@ -3386,6 +3400,7 @@ STR_NEWGRF_INSPECT_PARENT_TOOLTIP :{BLACK}Phân t STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT :{STRING} tại {HEX} STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_OBJECT :Đối Tượng STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Kiểu ray +STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_ROAD_TYPE :Loại đường STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}Biến số NewGRF là 60+x (dạng hexa) @@ -4701,6 +4716,11 @@ STR_AI_SETTINGS_SETTING :{STRING}: {ORAN # Textfile window +STR_TEXTFILE_JUMPLIST :{WHITE}Danh mục +STR_TEXTFILE_JUMPLIST_TOOLTIP :{BLACK}Dùng danh sách này để chuyển nhanh tới một phần trong tập tin được hiển thị +STR_TEXTFILE_JUMPLIST_ITEM :{WHITE}{STRING} +STR_TEXTFILE_NAVBACK_TOOLTIP :{BLACK}Trở về trước trong lịch sử điều hướng +STR_TEXTFILE_NAVFORWARD_TOOLTIP :{BLACK}Trở về sau trong lịch sử điều hướng STR_TEXTFILE_WRAP_TEXT :{WHITE}Ép văn bản STR_TEXTFILE_WRAP_TEXT_TOOLTIP :{BLACK}Ép chữ cái vừa khung cửa sổ để khỏi phải cuộn chuột STR_TEXTFILE_VIEW_README :{BLACK}Xem readme @@ -4711,6 +4731,7 @@ STR_TEXTFILE_README_CAPTION :{WHITE}Readme c STR_TEXTFILE_CHANGELOG_CAPTION :{WHITE}Lịch sử thay đổi của {STRING} {STRING} STR_TEXTFILE_LICENCE_CAPTION :{WHITE}Giấy phép của {STRING} {STRING} STR_TEXTFILE_SURVEY_RESULT_CAPTION :{WHITE}Xem trước kết quả khảo sát +STR_TEXTFILE_GAME_MANUAL_CAPTION :{WHITE}Tài liệu OpenTTD '{STRING}' # Vehicle loading indicators 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/demands.h b/src/linkgraph/demands.h index c21e9cdc99..14dbf11f65 100644 --- a/src/linkgraph/demands.h +++ b/src/linkgraph/demands.h @@ -36,7 +36,7 @@ public: * Call the demand calculator on the given component. * @param job Component to calculate the demands for. */ - virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); } + void Run(LinkGraphJob &job) const override { DemandCalculator c(job); } /** * Virtual destructor has to be defined because of virtual Run(). diff --git a/src/linkgraph/flowmapper.h b/src/linkgraph/flowmapper.h index da7375b8a6..c59aa3f527 100644 --- a/src/linkgraph/flowmapper.h +++ b/src/linkgraph/flowmapper.h @@ -28,7 +28,7 @@ public: * values. Only do that on the very last flow mapping. */ FlowMapper(bool scale) : scale(scale) {} - virtual void Run(LinkGraphJob &job) const; + void Run(LinkGraphJob &job) const override; private: diff --git a/src/linkgraph/init.h b/src/linkgraph/init.h index a627005162..a913613da3 100644 --- a/src/linkgraph/init.h +++ b/src/linkgraph/init.h @@ -16,7 +16,7 @@ public: * Initialize the link graph job. * @param job Job to be initialized. */ - virtual void Run(LinkGraphJob &job) const { job.Init(); } + void Run(LinkGraphJob &job) const override { job.Init(); } }; #endif /* INIT_H */ diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h index 0fc571346c..989758565c 100644 --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -306,7 +306,7 @@ public: } /** Bare constructor, only for save/load. */ - LinkGraph() : cargo(INVALID_CARGO), last_compression(0) {} + LinkGraph() : cargo(CT_INVALID), last_compression(0) {} /** * Real constructor. * @param cargo Cargo the link graph is about. diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index b6081591a1..d6b12005c1 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -760,7 +760,7 @@ void LinkGraphLegendWindow::SetOverlay(LinkGraphOverlay *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; @@ -819,7 +819,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)) { @@ -867,7 +867,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)) { @@ -899,7 +899,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 7df3c4b2a9..8e4d6956e4 100644 --- a/src/linkgraph/linkgraph_gui.h +++ b/src/linkgraph/linkgraph_gui.h @@ -128,10 +128,10 @@ public: LinkGraphLegendWindow(WindowDesc *desc, int window_number); void SetOverlay(LinkGraphOverlay *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 3d6a6e5aab..d6295f3f21 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -129,10 +129,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) { Node node_anno = this->job[node]; this->i = node_anno.GetEdges().begin(); @@ -232,7 +231,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/linkgraph/mcf.h b/src/linkgraph/mcf.h index 996e6698e7..e7597bdbcf 100644 --- a/src/linkgraph/mcf.h +++ b/src/linkgraph/mcf.h @@ -81,7 +81,7 @@ public: * Run the calculation. * @param graph Component to be calculated. */ - virtual void Run(LinkGraphJob &job) const { Tpass pass(job); } + void Run(LinkGraphJob &job) const override { Tpass pass(job); } }; #endif /* MCF_H */ diff --git a/src/main_gui.cpp b/src/main_gui.cpp index e76b207fb8..43ac27221a 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -515,7 +515,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); @@ -526,7 +526,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 7038152db5..3175d44fb9 100644 --- a/src/misc_cmd.cpp +++ b/src/misc_cmd.cpp @@ -131,10 +131,9 @@ CommandCost CmdDecreaseLoan(TileIndex tile, DoCommandFlag flags, uint32 p1, uint /** * 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) { DoCommandP(0, PM_PAUSED_ERROR, 0, CMD_PAUSE); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 4aef738549..3c1d1dae59 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -89,7 +89,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; @@ -374,7 +374,7 @@ public: ::ShowNewGRFInspectWindow(GetGrfSpecFeature(this->tile), 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: @@ -392,7 +392,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; @@ -529,7 +529,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; @@ -751,9 +751,9 @@ 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. */ + if (widget != WID_TT_BACKGROUND) return; if (this->params.size() == 0) { size->width = std::min(GetStringBoundingBox(this->buffer).width, ScaleGUITrad(194)); size->height = GetStringHeight(this->buffer, size->width); @@ -770,7 +770,7 @@ struct TooltipsWindow : public Window void DrawWidget(const Rect &r, int widget) const override { - /* There is only one widget. */ + if (widget != WID_TT_BACKGROUND) return; GfxFillRect(r, PC_BLACK); GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), PC_LIGHT_YELLOW); @@ -1069,7 +1069,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! */ @@ -1108,7 +1108,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: @@ -1220,7 +1220,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); @@ -1248,7 +1248,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; @@ -1270,7 +1270,7 @@ struct QueryWindow : public Window { this->message_str, 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: { diff --git a/src/music/allegro_m.cpp b/src/music/allegro_m.cpp index 6d06ce87ec..61edf81091 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 '%s'", allegro_error); diff --git a/src/music/cocoa_m.cpp b/src/music/cocoa_m.cpp index 279e0b38ae..3dae967f6c 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/dmusic.cpp b/src/music/dmusic.cpp index fd85469199..4cbe46f4ea 100644 --- a/src/music/dmusic.cpp +++ b/src/music/dmusic.cpp @@ -568,19 +568,19 @@ static void TransmitStandardSysex(IDirectMusicBuffer *buffer, REFERENCE_TIME rt, static void TransmitNotesOff(IDirectMusicBuffer *buffer, REFERENCE_TIME block_time, REFERENCE_TIME cur_time) { for (int ch = 0; ch < 16; ch++) { - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0); - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0); - TransmitChannelMsg(_buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_ALLNOTESOFF, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_SUSTAINSW, 0); + TransmitChannelMsg(buffer, block_time + 10, MIDIST_CONTROLLER | ch, MIDICT_MODE_RESETALLCTRL, 0); } /* Performing a GM reset stops all sound and resets all parameters. */ - TransmitStandardSysex(_buffer, block_time + 20, MidiSysexMessage::ResetGM); - TransmitStandardSysex(_buffer, block_time + 30, MidiSysexMessage::RolandSetReverb); + TransmitStandardSysex(buffer, block_time + 20, MidiSysexMessage::ResetGM); + TransmitStandardSysex(buffer, block_time + 30, MidiSysexMessage::RolandSetReverb); /* Explicitly flush buffer to make sure the messages are processed, * as we want sound to stop immediately. */ - _port->PlayBuffer(_buffer); - _buffer->Flush(); + _port->PlayBuffer(buffer); + buffer->Flush(); /* Wait until message time has passed. */ Sleep(Clamp((block_time - cur_time) / MS_TO_REFTIME, 5, 1000)); diff --git a/src/music/extmidi.cpp b/src/music/extmidi.cpp index 21fc8278ad..5e03905092 100644 --- a/src/music/extmidi.cpp +++ b/src/music/extmidi.cpp @@ -98,7 +98,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 79765d7e70..610f84575e 100644 --- a/src/music/win32_m.cpp +++ b/src/music/win32_m.cpp @@ -63,7 +63,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; @@ -112,7 +112,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 2ec98be793..0ba3dab23d 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -485,7 +485,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++) { @@ -500,7 +500,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: { @@ -568,7 +568,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 @@ -678,12 +678,11 @@ struct MusicWindow : public Window { this->SetWidgetsDisabledState( BaseMusic::GetUsedSet()->num_available == 0, WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE, - WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2, - WIDGET_LIST_END + WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2 ); } - 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. @@ -772,7 +771,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++) { @@ -788,7 +787,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 56723c2687..60d5b6ac4e 100644 --- a/src/network/core/address.cpp +++ b/src/network/core/address.cpp @@ -120,10 +120,9 @@ const char *NetworkAddressDumper::GetAddressAsString(NetworkAddress *addr, bool /** * 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 9368533fcf..83ebcb0d3b 100644 --- a/src/network/core/http_curl.cpp +++ b/src/network/core/http_curl.cpp @@ -175,7 +175,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 547f275e0f..e5e2ab9457 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 5c89bd2e9f..6b830bca25 100644 --- a/src/network/core/os_abstraction.cpp +++ b/src/network/core/os_abstraction.cpp @@ -131,7 +131,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; @@ -167,7 +167,7 @@ bool SetBlocking(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 95945aa732..a854521630 100644 --- a/src/network/core/tcp.cpp +++ b/src/network/core/tcp.cpp @@ -58,7 +58,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 42dea85ea6..91dc46b9e5 100644 --- a/src/network/core/tcp.h +++ b/src/network/core/tcp.h @@ -137,7 +137,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 7f7300e17d..1cf1421c12 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; @@ -128,40 +128,40 @@ NetworkRecvStatus NetworkAdminSocketHandler::ReceiveInvalidPacket(PacketAdminTyp return NETWORK_RECV_STATUS_MALFORMED_PACKET; } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); } - -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); } - -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); } -NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *p) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_JOIN); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_QUIT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_UPDATE_FREQUENCY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_UPDATE_FREQUENCY); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_POLL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_POLL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_EXTERNAL_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_EXTERNAL_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_RCON); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_GAMESCRIPT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_GAMESCRIPT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_ADMIN_PING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_ADMIN_PING); } + +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_FULL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_FULL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_BANNED(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_BANNED); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_ERROR); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PROTOCOL(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PROTOCOL); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_WELCOME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_WELCOME); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_NEWGAME(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_NEWGAME); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_SHUTDOWN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_SHUTDOWN); } + +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_DATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_DATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_JOIN(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_JOIN); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_INFO); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_UPDATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_QUIT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_QUIT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CLIENT_ERROR(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CLIENT_ERROR); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_NEW(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_NEW); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_INFO(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_INFO); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_UPDATE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_UPDATE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_REMOVE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_REMOVE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_ECONOMY(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_ECONOMY); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_COMPANY_STATS(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_COMPANY_STATS); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CHAT(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CHAT); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CONSOLE(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CONSOLE); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_NAMES(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_NAMES); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_CMD_LOGGING(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_CMD_LOGGING); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_RCON_END(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_RCON_END); } +NetworkRecvStatus NetworkAdminSocketHandler::Receive_SERVER_PONG(Packet *) { return this->ReceiveInvalidPacket(ADMIN_PACKET_SERVER_PONG); } diff --git a/src/network/core/tcp_content.cpp b/src/network/core/tcp_content.cpp index baabc118c5..e8fec48575 100644 --- a/src/network/core/tcp_content.cpp +++ b/src/network/core/tcp_content.cpp @@ -169,13 +169,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 aca87803a6..a0eaf343c9 100644 --- a/src/network/core/tcp_coordinator.cpp +++ b/src/network/core/tcp_coordinator.cpp @@ -86,20 +86,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 b191025b87..0e40173d28 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -105,7 +105,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) { if (this->ignore_close) return NETWORK_RECV_STATUS_CLIENT_QUIT; diff --git a/src/network/core/tcp_stun.cpp b/src/network/core/tcp_stun.cpp index dc565f0c0d..c76e0316c1 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 4800807cde..612a6b45a2 100644 --- a/src/network/core/tcp_turn.cpp +++ b/src/network/core/tcp_turn.cpp @@ -65,6 +65,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/network.cpp b/src/network/network.cpp index afcbf8df90..6ed9c2c11f 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -944,7 +944,7 @@ bool NetworkServerStart() /* Check for the client and server names to be set, but only after the scripts had a chance to set them.*/ if (_network_dedicated) CheckClientAndServerName(); - NetworkDisconnect(false, false); + NetworkDisconnect(false); NetworkInitialize(false); NetworkUDPInitialize(); DEBUG(net, 5, "Starting listeners for clients"); @@ -1017,10 +1017,9 @@ void NetworkReboot() /** * We want to disconnect from the host/clients. - * @param blocking whether to wait till everything has been closed. * @param close_admins Whether the admin sockets need to be closed as well. */ -void NetworkDisconnect(bool blocking, bool close_admins) +void NetworkDisconnect(bool close_admins) { if (_network_server) { for (NetworkClientSocket *cs : NetworkClientSocket::Iterate()) { @@ -1404,7 +1403,7 @@ void NetworkStartUp() /** This shuts the network down */ void NetworkShutDown() { - NetworkDisconnect(true); + NetworkDisconnect(); NetworkHTTPUninitialize(); NetworkUDPClose(); diff --git a/src/network/network_admin.cpp b/src/network/network_admin.cpp index 5fcf121365..69d2092c4e 100644 --- a/src/network/network_admin.cpp +++ b/src/network/network_admin.cpp @@ -664,7 +664,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 11aba02958..088919f1ae 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -320,7 +320,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); } @@ -463,7 +463,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 */ @@ -486,9 +486,11 @@ struct NetworkChatWindow : public Window { return state; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - _chat_tab_completion_active = false; + if (widget == WID_NC_TEXTBOX) { + _chat_tab_completion_active = false; + } } /** @@ -496,7 +498,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 9e09600399..89a5856395 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -751,7 +751,7 @@ bool ClientNetworkGameSocketHandler::IsConnected() extern bool SafeLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, GameMode newgm, Subdirectory subdir, struct LoadFilter *lf = nullptr, std::string *error_detail = 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); @@ -759,7 +759,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); @@ -1018,7 +1018,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; @@ -1280,7 +1280,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. */ @@ -1293,7 +1293,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 4707b8b3b8..5257b2bbf1 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -798,7 +798,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 9c5287fb4c..85918bf8d3 100644 --- a/src/network/network_content.h +++ b/src/network/network_content.h @@ -32,7 +32,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. @@ -43,20 +43,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 30f9d72ff6..3a2db11a79 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -115,7 +115,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: @@ -286,7 +286,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) { @@ -585,7 +585,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: @@ -792,7 +792,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; @@ -947,7 +947,7 @@ public: this->InvalidateData(0, false); } - void OnDownloadComplete(ContentID cid) override + void OnDownloadComplete(ContentID) override { this->content.ForceResort(); this->InvalidateData(); @@ -969,7 +969,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 570f15462f..4561255e6e 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_func.h b/src/network/network_func.h index be465545f5..921a2e730c 100644 --- a/src/network/network_func.h +++ b/src/network/network_func.h @@ -47,7 +47,7 @@ void NetworkUpdateServerGameType(); bool NetworkCompanyHasClients(CompanyID company); std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password); void NetworkReboot(); -void NetworkDisconnect(bool blocking = false, bool close_admins = true); +void NetworkDisconnect(bool close_admins = true); void NetworkGameLoop(); void NetworkBackgroundLoop(); std::string_view ParseFullConnectionString(const std::string &connection_string, uint16 &port, CompanyID *company_id = nullptr); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index af7152984d..4c3cda068d 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -536,7 +536,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: @@ -741,7 +741,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 @@ -839,7 +839,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->servers.ForceRebuild(); this->SetDirty(); @@ -1081,7 +1081,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: @@ -1101,7 +1101,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 @@ -1203,13 +1203,7 @@ struct NetworkStartServerWindow : public Window { void OnTimeout() override { - static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WIDGET_LIST_END}; - for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { - if (this->IsWidgetLowered(*widget)) { - this->RaiseWidget(*widget); - this->SetWidgetDirty(*widget); - } - } + this->RaiseWidgetsWhenLowered(WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU); } void OnQueryTextFinished(char *str) override @@ -1398,30 +1392,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; @@ -1431,10 +1422,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); } @@ -1529,7 +1519,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); } @@ -1540,7 +1530,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); @@ -1558,9 +1548,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) { DoCommandP(0, CCA_NEW, _network_own_client_id, CMD_COMPANY_CTRL); @@ -1575,7 +1564,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)); @@ -1597,7 +1586,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))); @@ -1618,7 +1607,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); } @@ -1746,7 +1735,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(); @@ -1755,7 +1744,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: @@ -1818,7 +1807,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: @@ -1852,7 +1841,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: { @@ -2145,7 +2134,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) { @@ -2232,7 +2221,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: @@ -2258,7 +2247,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(); @@ -2347,7 +2336,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; @@ -2371,7 +2360,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: @@ -2447,7 +2436,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); @@ -2463,7 +2452,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); @@ -2481,7 +2470,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: @@ -2550,7 +2539,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); @@ -2566,7 +2555,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); @@ -2574,7 +2563,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 b081d5d448..a9a020a5d1 100644 --- a/src/network/network_query.cpp +++ b/src/network/network_query.cpp @@ -81,7 +81,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; @@ -92,7 +92,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 7e8cec6f43..ac758a666e 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -940,7 +940,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_GAME_INFO(Packe } } -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 */ @@ -1136,7 +1136,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()) { diff --git a/src/network/network_server.h b/src/network/network_server.h index 70c4447964..88a39ca303 100644 --- a/src/network/network_server.h +++ b/src/network/network_server.h @@ -97,7 +97,7 @@ public: ServerNetworkGameSocketHandler(SOCKET s); ~ServerNetworkGameSocketHandler(); - virtual std::unique_ptr ReceivePacket() override; + std::unique_ptr ReceivePacket() override; NetworkRecvStatus CloseConnection(NetworkRecvStatus status) override; void GetClientName(char *client_name, const char *last) const; diff --git a/src/network/network_survey.cpp b/src/network/network_survey.cpp index bfd4943617..41c148e1fa 100644 --- a/src/network/network_survey.cpp +++ b/src/network/network_survey.cpp @@ -391,7 +391,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 bfc4919e59..44e5e0fcd6 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 3393f90339..7e2540cbae 100644 --- a/src/network/network_udp.cpp +++ b/src/network/network_udp.cpp @@ -120,7 +120,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 %s", NetworkAddressDumper().GetAddressAsString(client_addr)); diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 562c5141fb..3aedc4ef44 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -10177,10 +10177,9 @@ static void Act14FeatureTest(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 b94d6e11a4..ea56926ed9 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; } diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index 58c606a91a..b0abbc1d85 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -43,7 +43,7 @@ public: { } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { this->att++; if (this->att->ti.x == -0x80) { @@ -60,7 +60,7 @@ public: return this->att->gfx; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/newgrf_airporttiles.cpp b/src/newgrf_airporttiles.cpp index 4339f4978c..1d5c4521bf 100644 --- a/src/newgrf_airporttiles.cpp +++ b/src/newgrf_airporttiles.cpp @@ -246,7 +246,7 @@ uint16 GetAirportTileCallback(CallbackID callback, uint32 param1, uint32 param2, return object.ResolveCallback(); } -static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour, StationGfx gfx) +static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte colour) { const DrawTileSprites *dts = group->ProcessRegisters(nullptr); @@ -264,7 +264,7 @@ static void AirportDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGrou DrawNewGRFTileSeq(ti, dts, TO_BUILDINGS, 0, GENERAL_SPRITE_COLOUR(colour)); } -bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts) +bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts) { if (ti->tileh != SLOPE_FLAT) { bool draw_old_one = true; @@ -284,7 +284,7 @@ bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const Airport } const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; - AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour, gfx); + AirportDrawTileLayout(ti, tlgroup, Company::Get(st->owner)->colour); return true; } diff --git a/src/newgrf_airporttiles.h b/src/newgrf_airporttiles.h index aa2965583e..abc61814bb 100644 --- a/src/newgrf_airporttiles.h +++ b/src/newgrf_airporttiles.h @@ -88,6 +88,6 @@ void AnimateAirportTile(TileIndex tile); void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoID cargo_type = CT_INVALID); uint8 GetAirportTileAnimationSpeed(TileIndex tile); -bool DrawNewAirportTile(TileInfo *ti, Station *st, StationGfx gfx, const AirportTileSpec *airts); +bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts); #endif /* NEWGRF_AIRPORTTILES_H */ diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h index 0034212c89..4a3046a742 100644 --- a/src/newgrf_commons.h +++ b/src/newgrf_commons.h @@ -247,7 +247,7 @@ public: struct IndustryTileSpec; class IndustryTileOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16 testid) { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: IndustryTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} @@ -267,7 +267,7 @@ public: struct AirportTileSpec; class AirportTileOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16 testid) override { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: AirportTileOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} @@ -278,7 +278,7 @@ public: struct ObjectSpec; class ObjectOverrideManager : public OverrideManagerBase { protected: - virtual bool CheckValidNewID(uint16 testid) override { return testid != 0xFF; } + bool CheckValidNewID(uint16_t testid) override { return testid != 0xFF; } public: ObjectOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) : OverrideManagerBase(offset, maximum, invalid) {} diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 85b201a2fa..5c1b4672e7 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -74,6 +74,14 @@ GRFConfig::GRFConfig(const GRFConfig &config) : { } +/** + * Return whether this NewGRF can replace an older version of the same NewGRF. + */ +bool GRFConfig::IsCompatible(uint32_t old_version) const +{ + return this->min_loadable_version <= old_version && old_version <= this->version; +} + /** * Copy the parameter information from the \a src config. * @param src Source config. @@ -81,7 +89,6 @@ GRFConfig::GRFConfig(const GRFConfig &config) : void GRFConfig::CopyParams(const GRFConfig &src) { this->num_params = src.num_params; - this->num_valid_params = src.num_valid_params; this->param = src.param; } @@ -236,7 +243,6 @@ 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 new_value) { @@ -671,7 +677,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; @@ -792,7 +798,7 @@ const GRFConfig *FindGRFConfig(uint32 grfid, FindGRFConfigMode mode, const MD5Ha /* Skip incompatible stuff, unless explicitly allowed */ if (mode != FGCM_NEWEST && HasBit(c->flags, GCF_INVALID)) continue; /* check version compatibility */ - if (mode == FGCM_COMPATIBLE && (c->version < desired_version || c->min_loadable_version > desired_version)) continue; + if (mode == FGCM_COMPATIBLE && !c->IsCompatible(desired_version)) continue; /* remember the newest one as "the best" */ if (best == nullptr || c->version > best->version) best = c; } diff --git a/src/newgrf_config.h b/src/newgrf_config.h index dd7260b11d..bf6dceabe4 100644 --- a/src/newgrf_config.h +++ b/src/newgrf_config.h @@ -179,6 +179,7 @@ struct GRFConfig : ZeroedMemoryAllocator { struct GRFConfig *next; ///< NOSAVE: Next item in the linked list + bool IsCompatible(uint32_t old_version) const; void CopyParams(const GRFConfig &src); const char *GetTextfile(TextfileType type) const; diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 2be0f628dd..8e4eb283bd 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -418,7 +418,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: { @@ -763,7 +763,7 @@ struct NewGRFInspectWindow : Window { break; case NIT_CARGO: - string = value != INVALID_CARGO ? CargoSpec::Get(value)->name : STR_QUANTITY_N_A; + string = value != CT_INVALID ? CargoSpec::Get(value)->name : STR_QUANTITY_N_A; break; default: @@ -829,7 +829,7 @@ struct NewGRFInspectWindow : Window { this->selected_highlight_tags[lengthof(this->selected_highlight_tags) - 1] = tag; } - 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: { @@ -1015,7 +1015,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()) { @@ -1320,7 +1320,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: @@ -1385,7 +1385,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: @@ -1495,7 +1495,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_gui.cpp b/src/newgrf_gui.cpp index 498552b5c0..cc538c5082 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -219,7 +219,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: @@ -340,7 +340,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: @@ -406,7 +406,7 @@ struct NewGRFParametersWindow : public Window { list.emplace_back(new DropDownListStringItem(GetGRFStringFromGRFText(par_info.value_names.find(i)->second), i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_NP_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -464,14 +464,16 @@ struct NewGRFParametersWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget != WID_NP_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); GRFParameterInfo &par_info = this->GetParameterInfo(this->clicked_row); par_info.SetValue(this->grf_config, index); this->SetDirty(); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { + if (widget != WID_NP_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is @@ -491,7 +493,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) { @@ -736,7 +738,11 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { while (*c != iter->second) c = &(*c)->next; GRFConfig *d = new GRFConfig(*a); d->next = (*c)->next; - d->CopyParams(**c); + if (d->IsCompatible((*c)->version)) { + d->CopyParams(**c); + } else { + d->SetParameterDefaults(); + } if (this->active_sel == *c) { CloseWindowByClass(WC_GRF_PARAMETERS); CloseWindowByClass(WC_TEXTFILE); @@ -748,7 +754,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: @@ -947,7 +953,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; @@ -1191,6 +1197,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { void OnDropdownSelect(int widget, int index) override { + if (widget != WID_NS_PRESET_LIST) return; if (!this->editable) return; ClearGRFConfigList(&this->actives); @@ -1245,7 +1252,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) { @@ -1302,8 +1309,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetDisabledState(WID_NS_APPLY_CHANGES, !((this->editable && this->modified) || _settings_client.gui.newgrf_developer_tools)); this->SetWidgetsDisabledState(!this->editable, WID_NS_PRESET_LIST, - WID_NS_TOGGLE_PALETTE, - WIDGET_LIST_END + WID_NS_TOGGLE_PALETTE ); this->SetWidgetDisabledState(WID_NS_ADD, !this->editable || this->avail_sel == nullptr || HasBit(this->avail_sel->flags, GCF_INVALID)); this->SetWidgetDisabledState(WID_NS_UPGRADE, !this->editable || this->actives == nullptr || !this->CanUpgradeCurrent()); @@ -1312,8 +1318,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetsDisabledState(disable_all, WID_NS_REMOVE, WID_NS_MOVE_UP, - WID_NS_MOVE_DOWN, - WIDGET_LIST_END + WID_NS_MOVE_DOWN ); const GRFConfig *selected_config = (this->avail_sel == nullptr) ? this->active_sel : this->avail_sel; @@ -1376,14 +1381,16 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { if (!this->editable) return; - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->avails.SetFilterState(!string_filter.IsEmpty()); - this->avails.ForceRebuild(); - this->InvalidateData(0); + if (widget == WID_NS_FILTER) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->avails.SetFilterState(!string_filter.IsEmpty()); + this->avails.ForceRebuild(); + this->InvalidateData(0); + } } void OnDragDrop(Point pt, int widget) override @@ -2165,7 +2172,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: { @@ -2239,7 +2246,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.h b/src/newgrf_house.h index cd49aeca77..73858e1ebc 100644 --- a/src/newgrf_house.h +++ b/src/newgrf_house.h @@ -70,7 +70,7 @@ struct FakeHouseScopeResolver : public CommonHouseScopeResolver { : CommonHouseScopeResolver(ro, house_id) { } - /* virtual */ uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const; + /* virtual */ uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const override; }; /** Resolver object to be used for houses (feature 07 spritegroups). */ diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index e30494579d..d5df46d60d 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -672,9 +672,11 @@ void IndustryProductionCallback(Industry *ind, int reason) if (group->version < 2) { /* Callback parameters map directly to industry cargo slot indices */ for (uint i = 0; i < group->num_input; i++) { + if (ind->accepts_cargo[i] == CT_INVALID) continue; ind->incoming_cargo_waiting[i] = ClampTo(ind->incoming_cargo_waiting[i] - DerefIndProd(group->subtract_input[i], deref) * multiplier); } for (uint i = 0; i < group->num_output; i++) { + if (ind->produced_cargo[i] == CT_INVALID) continue; ind->produced_cargo_waiting[i] = ClampTo(ind->produced_cargo_waiting[i] + std::max(DerefIndProd(group->add_output[i], deref), 0) * multiplier); } } else { diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index 9be47c7557..60cbfe2d3d 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -159,7 +159,7 @@ uint32 IndustryTileResolverObject::GetDebugID() const return GetIndustryTileSpec(gfx)->grf_prop.local_id; } -static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage, IndustryGfx gfx) +static void IndustryDrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte rnd_colour, byte stage) { const DrawTileSprites *dts = group->ProcessRegisters(&stage); @@ -212,7 +212,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus /* Limit the building stage to the number of stages supplied. */ const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group; byte stage = GetIndustryConstructionStage(ti->tile); - IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage, gfx); + IndustryDrawTileLayout(ti, tlgroup, i->random_colour, stage); return true; } diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index e157e8a782..bbb2b19ccb 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -574,7 +574,6 @@ void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 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 StubGetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, int extra_data) diff --git a/src/newgrf_roadstop.cpp b/src/newgrf_roadstop.cpp index aa8f9d498b..91c1daa92a 100644 --- a/src/newgrf_roadstop.cpp +++ b/src/newgrf_roadstop.cpp @@ -39,7 +39,7 @@ void NewGRFClass::InsertDefaults() } template -bool NewGRFClass::IsUIAvailable(uint index) const +bool NewGRFClass::IsUIAvailable(uint) const { return true; } @@ -470,15 +470,8 @@ void TriggerRoadStopRandomisation(Station *st, TileIndex tile, RoadStopRandomTri uint32 whole_reseed = 0; - CargoTypes empty_mask = 0; - if (trigger == RSRT_CARGO_TAKEN) { - /* Create a bitmask of completely empty cargo types to be matched */ - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (st->goods[i].CargoTotalCount() == 0) { - SetBit(empty_mask, i); - } - } - } + /* Bitmask of completely empty cargo types to be matched. */ + CargoTypes empty_mask = (trigger == RSRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0; uint32 used_triggers = 0; auto process_tile = [&](TileIndex cur_tile) { diff --git a/src/newgrf_roadtype.h b/src/newgrf_roadtype.h index b18c243a33..71593777b9 100644 --- a/src/newgrf_roadtype.h +++ b/src/newgrf_roadtype.h @@ -32,8 +32,8 @@ struct RoadTypeScopeResolver : public ScopeResolver { { } - /* virtual */ uint32 GetRandomBits() const; - /* virtual */ uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const; + uint32 GetRandomBits() const override; + uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const override; }; /** Resolver object for road types. */ diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 1dbf212b69..56778e731c 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -142,8 +142,6 @@ static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *sc /** * 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 value) {} @@ -162,8 +160,6 @@ static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *sc /** * 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, VarSpriteGroupScopeOffset relative) diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 410e715f2b..8b743f7446 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -71,7 +71,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; @@ -593,8 +593,8 @@ struct ResultSpriteGroup : SpriteGroup { SpriteID sprite; byte num_sprites; - SpriteID GetResult() const { return this->sprite; } - byte GetNumResults() const { return this->num_sprites; } + SpriteID GetResult() const override { return this->sprite; } + byte GetNumResults() const override { return this->num_sprites; } }; /** diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 8700f3bd36..a533585e6c 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -41,7 +41,7 @@ template } template -bool NewGRFClass::IsUIAvailable(uint index) const +bool NewGRFClass::IsUIAvailable(uint) const { return true; } @@ -418,12 +418,7 @@ uint32 Station::GetNewGRFVariable(const ResolverObject &object, uint16 variable, { switch (variable) { case 0x48: { // Accepted cargo types - CargoID cargo_type; - uint32 value = 0; - - for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) { - if (HasBit(this->goods[cargo_type].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(value, cargo_type); - } + uint32_t value = GetAcceptanceMask(this); return value; } @@ -964,15 +959,8 @@ void TriggerStationRandomisation(Station *st, TileIndex trigger_tile, StationRan uint32 whole_reseed = 0; ETileArea area = ETileArea(st, trigger_tile, tas[trigger]); - CargoTypes empty_mask = 0; - if (trigger == SRT_CARGO_TAKEN) { - /* Create a bitmask of completely empty cargo types to be matched */ - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (st->goods[i].CargoTotalCount() == 0) { - SetBit(empty_mask, i); - } - } - } + /* Bitmask of completely empty cargo types to be matched. */ + CargoTypes empty_mask = (trigger == SRT_CARGO_TAKEN) ? GetEmptyMask(st) : 0; /* Store triggers now for var 5F */ SetBit(st->waiting_triggers, trigger); diff --git a/src/newgrf_storage.cpp b/src/newgrf_storage.cpp index ec8136cbd2..ca71abec49 100644 --- a/src/newgrf_storage.cpp +++ b/src/newgrf_storage.cpp @@ -52,7 +52,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_storage.h b/src/newgrf_storage.h index b8d5d60d8a..70540c386f 100644 --- a/src/newgrf_storage.h +++ b/src/newgrf_storage.h @@ -114,7 +114,7 @@ struct PersistentStorageArray : BasePersistentStorageArray { return this->storage[pos]; } - void ClearChanges() + void ClearChanges() override { if (this->prev_storage) { this->storage = *this->prev_storage; diff --git a/src/newgrf_town.h b/src/newgrf_town.h index d3313336df..332f43c733 100644 --- a/src/newgrf_town.h +++ b/src/newgrf_town.h @@ -34,8 +34,8 @@ struct TownScopeResolver : public ScopeResolver { { } - virtual uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const; - virtual void StorePSA(uint reg, int32 value); + virtual uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const override; + virtual void StorePSA(uint reg, int32 value) override; }; /** @@ -53,7 +53,7 @@ struct FakeTownScopeResolver : public ScopeResolver { FakeTownScopeResolver(ResolverObject &ro) : ScopeResolver(ro) { } - virtual uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const; + virtual uint32 GetVariable(uint16 variable, uint32 parameter, GetVariableExtra *extra) const override; }; /** Resolver of town properties. */ diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 19d327e378..f5543da46a 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -344,7 +344,7 @@ struct NewsWindow : 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 { StringID str = STR_NULL; switch (widget) { @@ -480,7 +480,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: @@ -542,7 +542,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 */ @@ -551,7 +551,7 @@ struct NewsWindow : Window { this->SetWindowTop(newtop); } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { int count = this->timer.CountElapsed(delta_ms); if (count > 0) { @@ -1134,7 +1134,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; @@ -1189,13 +1189,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 c072e2570f..f6f155229d 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -659,7 +659,7 @@ static void DrawTile_Object(TileInfo *ti, DrawTileProcParams params) 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; @@ -993,7 +993,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; } @@ -1014,10 +1014,9 @@ 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 d70bac0e29..4b30fd3629 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -220,7 +220,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: { @@ -517,7 +517,7 @@ public: object_number = -1; } else { view_number = sel_view; - ObjectClass *objclass = ObjectClass::Get(_selected_object_class); + ObjectClass *objclass = ObjectClass::Get(object_class); object_number = objclass->GetUIFromIndex(sel_index); } @@ -527,7 +527,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; @@ -539,7 +539,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: { @@ -567,7 +567,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); if (spec == nullptr) return; @@ -589,7 +589,7 @@ public: 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) { switch (select_proc) { @@ -624,12 +624,14 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->object_classes.SetFilterState(!string_filter.IsEmpty()); - this->object_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BO_FILTER) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->object_classes.SetFilterState(!string_filter.IsEmpty()); + this->object_classes.ForceRebuild(); + this->InvalidateData(); + } } /** diff --git a/src/openttd.cpp b/src/openttd.cpp index ec5698c0c4..bb5dea9be0 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -622,7 +622,7 @@ struct AfterNewGRFScan : NewGRFScanCallback { static_assert(sizeof(generation_seed) == sizeof(_settings_game.game_creation.generation_seed)); } - virtual void OnNewGRFsScanned() + void OnNewGRFsScanned() override { ResetGRFConfig(false); diff --git a/src/order_base.h b/src/order_base.h index 07fb4961c1..624caddcab 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -948,7 +948,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 c229070619..9cf04e0d97 100644 --- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1973,7 +1973,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; @@ -2681,7 +2681,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: { @@ -3406,7 +3406,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/font_osx.cpp b/src/os/macosx/font_osx.cpp index 4a576f8043..1444fdb565 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/macosx/string_osx.h b/src/os/macosx/string_osx.h index 3e29b16f5c..c4dae6bb49 100644 --- a/src/os/macosx/string_osx.h +++ b/src/os/macosx/string_osx.h @@ -64,6 +64,7 @@ public: */ static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c) { + assert(buff < buffer_last); if (c >= 0x010000U) { /* Character is encoded using surrogates in UTF-16. */ if (buff + 1 <= buffer_last) { diff --git a/src/os/unix/font_unix.cpp b/src/os/unix/font_unix.cpp index e6b5f49883..4940ff0ca4 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 345c63f308..2a797192b6 100644 --- a/src/os/unix/unix.cpp +++ b/src/os/unix/unix.cpp @@ -67,7 +67,7 @@ bool FiosIsRoot(const char *path) return path[1] == '\0'; } -void FiosGetDrives(FileList &file_list) +void FiosGetDrives(FileList &) { return; } @@ -213,7 +213,7 @@ void ShowInfo(const char *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))) { @@ -304,7 +304,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 e5626f6630..4c1faf94d9 100644 --- a/src/os/windows/crashlog_win.cpp +++ b/src/os/windows/crashlog_win.cpp @@ -728,7 +728,7 @@ static LONG WINAPI VectoredExceptionHandler(EXCEPTION_POINTERS *ep) return EXCEPTION_CONTINUE_SEARCH; } -static void CDECL CustomAbort(int signal) +static void CDECL CustomAbort(int) { RaiseException(0xE1212012, 0, 0, nullptr); } @@ -832,7 +832,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 c473316785..726ae8bb1c 100644 --- a/src/os/windows/font_win32.cpp +++ b/src/os/windows/font_win32.cpp @@ -87,7 +87,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; @@ -125,7 +125,7 @@ bool SetFallbackFont(FontCacheSettings *settings, const std::string &language_is Win32FontCache::Win32FontCache(FontSize fs, const LOGFONT &logfont, int pixels) : TrueTypeFontCache(fs, pixels), logfont(logfont) { this->dc = CreateCompatibleDC(nullptr); - this->SetFontSize(fs, pixels); + this->SetFontSize(pixels); } Win32FontCache::~Win32FontCache() @@ -135,7 +135,7 @@ Win32FontCache::~Win32FontCache() DeleteObject(this->font); } -void Win32FontCache::SetFontSize(FontSize fs, int pixels) +void Win32FontCache::SetFontSize(int pixels) { if (pixels == 0) { /* Try to determine a good height based on the minimal height recommended by the font. */ @@ -201,7 +201,7 @@ void Win32FontCache::SetFontSize(FontSize fs, int pixels) void Win32FontCache::ClearFontCache() { /* GUI scaling might have changed, determine font size anew if it was automatically selected. */ - if (this->font != nullptr) this->SetFontSize(this->fs, this->req_size); + if (this->font != nullptr) this->SetFontSize(this->req_size); this->TrueTypeFontCache::ClearFontCache(); } diff --git a/src/os/windows/font_win32.h b/src/os/windows/font_win32.h index 7f5f62a7f2..8261dc7b4a 100644 --- a/src/os/windows/font_win32.h +++ b/src/os/windows/font_win32.h @@ -23,7 +23,7 @@ private: SIZE glyph_size; ///< Maximum size of regular glyphs. std::string fontname; ///< Cached copy of loaded font facename - void SetFontSize(FontSize fs, int pixels); + void SetFontSize(int pixels); protected: const void *InternalGetFontTable(uint32 tag, size_t &length) override; diff --git a/src/os/windows/string_uniscribe.h b/src/os/windows/string_uniscribe.h index 7ec7ca6708..a41b76bdb0 100644 --- a/src/os/windows/string_uniscribe.h +++ b/src/os/windows/string_uniscribe.h @@ -46,6 +46,7 @@ public: */ static size_t AppendToBuffer(CharType *buff, const CharType *buffer_last, WChar c) { + assert(buff < buffer_last); if (c >= 0x010000U) { /* Character is encoded using surrogates in UTF-16. */ if (buff + 1 <= buffer_last) { diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index b09ffb80ab..b6f1b6d8cc 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -357,7 +357,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/osk_gui.cpp b/src/osk_gui.cpp index f0c2fbac09..32a9f6d8b0 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) { @@ -185,12 +185,14 @@ struct OskWindow : public Window { void OnEditboxChanged(int widget) override { - this->SetWidgetDirty(WID_OSK_TEXT); - this->parent->OnEditboxChanged(this->text_btn); - this->parent->SetWidgetDirty(this->text_btn); + if (widget == WID_OSK_TEXT) { + this->SetWidgetDirty(WID_OSK_TEXT); + this->parent->OnEditboxChanged(this->text_btn); + this->parent->SetWidgetDirty(this->text_btn); + } } - void OnInvalidateData(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/yapf/yapf_costcache.hpp b/src/pathfinder/yapf/yapf_costcache.hpp index 1b4d52cff2..b0e78666d6 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 9fa9697663..ae50fdfd36 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 da0cb00d4d..bc9521c803 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -540,7 +540,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 2b365381ff..5e9915c30f 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -48,7 +48,7 @@ protected: return *p; } - 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; @@ -242,7 +242,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/plans_gui.cpp b/src/plans_gui.cpp index fc3c078365..e30aa841a9 100644 --- a/src/plans_gui.cpp +++ b/src/plans_gui.cpp @@ -254,10 +254,10 @@ struct PlansWindow : Window { this->SetWidgetDisabledState(WID_PLN_SHOW_ALL, this->vscroll->GetCount() == 0); this->hide_all_sel->SetDisplayedPlane(this->vscroll->GetCount() != 0 && this->AllPlansHidden() ? 1 : 0); if (_current_plan) { - this->SetWidgetsDisabledState(_current_plan->owner != _local_company, WID_PLN_ADD_LINES, WID_PLN_VISIBILITY, WID_PLN_DELETE, WID_PLN_RENAME, WID_PLN_COLOUR, WIDGET_LIST_END); + this->SetWidgetsDisabledState(_current_plan->owner != _local_company, WID_PLN_ADD_LINES, WID_PLN_VISIBILITY, WID_PLN_DELETE, WID_PLN_RENAME, WID_PLN_COLOUR); this->GetWidget(WID_PLN_VISIBILITY)->widget_data = _current_plan->visible_by_all ? STR_PLANS_VISIBILITY_PRIVATE : STR_PLANS_VISIBILITY_PUBLIC; } else { - this->SetWidgetsDisabledState(true, WID_PLN_ADD_LINES, WID_PLN_VISIBILITY, WID_PLN_DELETE, WID_PLN_RENAME, WID_PLN_COLOUR, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_PLN_ADD_LINES, WID_PLN_VISIBILITY, WID_PLN_DELETE, WID_PLN_RENAME, WID_PLN_COLOUR); } this->DrawWidgets(); } diff --git a/src/programmable_signals.h b/src/programmable_signals.h index 1365471690..38bd0ad5ad 100644 --- a/src/programmable_signals.h +++ b/src/programmable_signals.h @@ -162,7 +162,7 @@ protected: class SignalSimpleCondition: public SignalCondition { public: SignalSimpleCondition(SignalConditionCode code); - virtual bool Evaluate(SignalVM& vm); + bool Evaluate(SignalVM& vm) override; }; /** Comparator to use for variable conditions. */ @@ -209,7 +209,7 @@ public: SignalVariableCondition(SignalConditionCode code); /// Evaluates the condition - virtual bool Evaluate(SignalVM &vm); + bool Evaluate(SignalVM &vm) override; }; /** A condition which is based upon the state of another signal. */ @@ -222,7 +222,7 @@ class SignalStateCondition: public SignalCondition { bool CheckSignalValid(); void Invalidate(); - virtual bool Evaluate(SignalVM& vm); + bool Evaluate(SignalVM& vm) override; virtual ~SignalStateCondition(); SignalReference this_sig; @@ -240,7 +240,7 @@ class SignalSlotCondition: public SignalConditionComparable { bool CheckSlotValid(); void Invalidate(); - virtual bool Evaluate(SignalVM& vm); + bool Evaluate(SignalVM& vm) override; virtual ~SignalSlotCondition(); SignalReference this_sig; @@ -257,7 +257,7 @@ class SignalCounterCondition: public SignalConditionComparable { bool CheckCounterValid(); void Invalidate(); - virtual bool Evaluate(SignalVM& vm); + bool Evaluate(SignalVM& vm) override; virtual ~SignalCounterCondition(); SignalReference this_sig; @@ -292,7 +292,7 @@ public: * vectored to the first instruction; if it is an End instruction, the program * will terminate and the signal will be left red. */ - virtual void Evaluate(SignalVM &vm); + void Evaluate(SignalVM &vm) override; /** Links the first and last instructions in the program. Generally only to be * called from the SignalProgram constructor. @@ -306,14 +306,14 @@ public: * This operation, unlike when executed on most instructions, does not destroy * the instruction. */ - virtual void Remove(); + void Remove() override; /** The next instruction after this one. On the End instruction, this should * be nullptr. */ SignalInstruction *next; - virtual void SetNext(SignalInstruction *next_insn); + void SetNext(SignalInstruction *next_insn) override; }; /** If signal instruction. This is perhaps the most important, as without it, @@ -350,16 +350,16 @@ public: /** Removes the pseudo instruction. Unless you are also removing the If it * belongs to, this is nonsense and dangerous. */ - virtual void Remove(); + void Remove() override; /** Evaluate the pseudo instruction. This involves vectoring execution to * the instruction after the if. */ - virtual void Evaluate(SignalVM &vm); + void Evaluate(SignalVM &vm) override; /** The block to which this instruction belongs */ SignalIf *block; - virtual void SetNext(SignalInstruction *next_insn); + void SetNext(SignalInstruction *next_insn) override; }; public: @@ -373,19 +373,19 @@ public: void SetCondition(SignalCondition *cond); /** Evaluates the If and takes the appropriate branch */ - virtual void Evaluate(SignalVM &vm); + void Evaluate(SignalVM &vm) override; - virtual void Insert(SignalInstruction *before_insn); + void Insert(SignalInstruction *before_insn) override; /** Removes the If and all of its children */ - virtual void Remove(); + void Remove() override; SignalCondition *condition; ///< The if conditon SignalInstruction *if_true; ///< The branch to take if true SignalInstruction *if_false; ///< The branch to take if false SignalInstruction *after; ///< The branch to take after the If - virtual void SetNext(SignalInstruction *next_insn); + void SetNext(SignalInstruction *next_insn) override; }; /** Set signal instruction. This sets the state of the signal and terminates execution */ @@ -394,8 +394,8 @@ public: /// Constructs the instruction and sets the state the signal is to be set to SignalSet(SignalProgram *prog, SignalState = SIGNAL_STATE_RED); - virtual void Evaluate(SignalVM &vm); - virtual void Remove(); + void Evaluate(SignalVM &vm) override; + void Remove() override; /// The state to set the signal to SignalState to_state; @@ -403,7 +403,7 @@ public: /// The instruction following this one (for the editor) SignalInstruction *next; - virtual void SetNext(SignalInstruction *next_insn); + void SetNext(SignalInstruction *next_insn) override; }; /// The map type used for looking up signal programs diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index fe2339deda..d71dd2e332 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -4130,7 +4130,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; @@ -4742,7 +4742,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; } diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 0897f7170f..bcd98b47dd 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -510,7 +510,7 @@ struct BuildRailToolbarWindow : Window { this->InitNested(TRANSPORT_RAIL); this->SetupRailToolbar(railtype); this->DisableWidget(WID_RAT_REMOVE); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_RAT; if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); } @@ -785,7 +785,7 @@ struct BuildRailToolbarWindow : Window { } } - 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: @@ -851,7 +851,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; @@ -859,7 +859,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) { @@ -939,7 +939,7 @@ struct BuildRailToolbarWindow : Window { CloseWindowByClass(WC_BUILD_BRIDGE); } - void OnPlacePresize(Point pt, TileIndex tile) override + void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile) override { DoCommand(tile, _cur_railtype | (TRANSPORT_RAIL << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); @@ -952,7 +952,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, false); } @@ -1324,7 +1324,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; @@ -1346,12 +1346,14 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->station_classes.SetFilterState(!string_filter.IsEmpty()); - this->station_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BRAS_FILTER_EDITBOX) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->station_classes.SetFilterState(!string_filter.IsEmpty()); + this->station_classes.ForceRebuild(); + this->InvalidateData(); + } } void OnPaint() override @@ -1403,7 +1405,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: { @@ -1541,7 +1543,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: @@ -1697,7 +1699,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } @@ -1950,11 +1952,11 @@ private: this->GetWidget(WID_BS_ELECTRIC_NOEN_SEL)->SetDisplayedPlane(this->noentry_ui_shown ? 0 : SZSP_NONE); this->GetWidget(WID_BS_PROGRAM_SEL)->SetDisplayedPlane(show_progsig ? 0 : 1); this->SetWidgetDisabledState(WID_BS_PROGRAM, !show_progsig); - this->SetWidgetsDisabledState(!show_norm, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_NORM, WIDGET_LIST_END); + this->SetWidgetsDisabledState(!show_norm, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_NORM); this->SetWidgetsDisabledState(!show_presig, WID_BS_SEMAPHORE_ENTRY, WID_BS_ELECTRIC_ENTRY, WID_BS_SEMAPHORE_EXIT, - WID_BS_ELECTRIC_EXIT, WID_BS_SEMAPHORE_COMBO, WID_BS_ELECTRIC_COMBO, WIDGET_LIST_END); - this->SetWidgetsDisabledState(!show_progsig, WID_BS_SEMAPHORE_PROG, WID_BS_ELECTRIC_PROG, WIDGET_LIST_END); - this->SetWidgetsDisabledState(!this->noentry_ui_shown, WID_BS_SEMAPHORE_NO_ENTRY, WID_BS_ELECTRIC_NO_ENTRY, WIDGET_LIST_END); + WID_BS_ELECTRIC_EXIT, WID_BS_SEMAPHORE_COMBO, WID_BS_ELECTRIC_COMBO); + this->SetWidgetsDisabledState(!show_progsig, WID_BS_SEMAPHORE_PROG, WID_BS_ELECTRIC_PROG); + this->SetWidgetsDisabledState(!this->noentry_ui_shown, WID_BS_SEMAPHORE_NO_ENTRY, WID_BS_ELECTRIC_NO_ENTRY); this->GetWidget(WID_BS_TOGGLE_SIZE_SEL)->SetDisplayedPlane(!this->realistic_braking_mode ? 0 : SZSP_NONE); this->SetWidgetDisabledState(WID_BS_TOGGLE_SIZE, this->realistic_braking_mode); @@ -2017,7 +2019,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. */ @@ -2210,7 +2212,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_button); @@ -2360,7 +2362,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; @@ -2381,7 +2383,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: @@ -2588,7 +2590,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: { @@ -2754,7 +2756,6 @@ 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 new_value) { diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 9ce9bded57..70ec13828f 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -607,10 +607,9 @@ CommandCost CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, R * @param flags operation to perform * @param pieces roadbits to remove * @param rt roadtype to remove - * @param crossing_check should we check if there is a tram track when we are removing road from crossing? * @param town_check should we check if the town allows removal? */ -static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool crossing_check, bool town_check = true) +static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits pieces, RoadTramType rtt, bool town_check) { assert(pieces != ROAD_NONE); @@ -1683,7 +1682,7 @@ CommandCost CmdRemoveLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 _additional_cash_required = DoCommand(start_tile, end_tile, p2, flags & ~DC_EXEC, CMD_REMOVE_LONG_ROAD).GetCost(); return cost; } - RemoveRoad(tile, flags, bits, rtt, true, false); + RemoveRoad(tile, flags, bits, rtt, false); } cost.AddCost(ret); had_success = true; @@ -1822,7 +1821,7 @@ static CommandCost ClearTile_Road(TileIndex tile, DoCommandFlag flags) for (RoadTramType rtt : { RTT_TRAM, RTT_ROAD }) { if (!MayHaveRoad(tile) || GetRoadType(tile, rtt) == INVALID_ROADTYPE) continue; - CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, false); + CommandCost tmp_ret = RemoveRoad(tile, flags, GetCrossingRoadBits(tile), rtt, true); if (tmp_ret.Failed()) return tmp_ret; ret.AddCost(tmp_ret); } @@ -2491,7 +2490,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)) { @@ -2848,7 +2847,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 f95be68365..dc97044758 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -372,7 +372,7 @@ struct BuildRoadToolbarWindow : Window { } this->OnInvalidateData(); - this->last_started_action = WIDGET_LIST_END; + this->last_started_action = INVALID_WID_ROT; if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this); } @@ -391,7 +391,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); @@ -401,8 +401,7 @@ struct BuildRoadToolbarWindow : Window { WID_ROT_DEPOT, WID_ROT_BUILD_WAYPOINT, WID_ROT_BUS_STATION, - WID_ROT_TRUCK_STATION, - WIDGET_LIST_END); + WID_ROT_TRUCK_STATION); if (!can_build) { CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); @@ -529,7 +528,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; @@ -628,7 +627,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; @@ -712,7 +711,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. @@ -755,7 +754,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) { @@ -836,7 +835,7 @@ struct BuildRoadToolbarWindow : Window { } } - void OnPlacePresize(Point pt, TileIndex tile) override + void OnPlacePresize([[maybe_unused]] Point pt, TileIndex tile) override { DoCommand(tile, _cur_roadtype | (TRANSPORT_ROAD << 8), 0, DC_AUTO, CMD_BUILD_TUNNEL); VpSetPresizeRange(tile, _build_tunnel_endtile == 0 ? tile : _build_tunnel_endtile); @@ -1142,7 +1141,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; @@ -1163,7 +1162,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: @@ -1443,7 +1442,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; @@ -1465,12 +1464,14 @@ public: return ES_HANDLED; } - void OnEditboxChanged(int wid) override + void OnEditboxChanged(int widget) override { - string_filter.SetFilterTerm(this->filter_editbox.text.buf); - this->roadstop_classes.SetFilterState(!string_filter.IsEmpty()); - this->roadstop_classes.ForceRebuild(); - this->InvalidateData(); + if (widget == WID_BROS_FILTER_EDITBOX) { + string_filter.SetFilterTerm(this->filter_editbox.text.buf); + this->roadstop_classes.SetFilterState(!string_filter.IsEmpty()); + this->roadstop_classes.ForceRebuild(); + this->InvalidateData(); + } } void OnPaint() override @@ -1672,7 +1673,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: @@ -1740,7 +1741,7 @@ public: } } - void OnRealtimeTick(uint delta_ms) override + void OnRealtimeTick([[maybe_unused]] uint delta_ms) override { CheckRedrawStationCoverage(this); } diff --git a/src/saveload/game_sl.cpp b/src/saveload/game_sl.cpp index 111807d0bd..5aa60d44a0 100644 --- a/src/saveload/game_sl.cpp +++ b/src/saveload/game_sl.cpp @@ -38,7 +38,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/saveload.cpp b/src/saveload/saveload.cpp index 0cf09261ed..02301dc072 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1629,7 +1629,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(); } @@ -1685,7 +1685,7 @@ std::vector SlTableHeader(const SaveLoadTable &slt) } while (true) { - uint8 type; + uint8 type = 0; SlSaveLoadConv(&type, SLE_UINT8); if (type == SLE_FILE_END) break; diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 221c62fab5..d068bb2352 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -97,25 +97,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. @@ -152,16 +152,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/station_sl.cpp b/src/saveload/station_sl.cpp index 299deb1806..9c8f643e91 100644 --- a/src/saveload/station_sl.cpp +++ b/src/saveload/station_sl.cpp @@ -444,13 +444,13 @@ public: }; inline const static SaveLoadCompatTable compat_description = _station_normal_sl_compat; - void Save(BaseStation *bst) const + void Save(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetDescription()); } - void Load(BaseStation *bst) const + void Load(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetLoadDescription()); @@ -460,7 +460,7 @@ public: } } - void FixPointers(BaseStation *bst) const + void FixPointers(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) != 0) return; SlObject(bst, this->GetDescription()); @@ -479,19 +479,19 @@ public: }; inline const static SaveLoadCompatTable compat_description = _station_waypoint_sl_compat; - void Save(BaseStation *bst) const + void Save(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetDescription()); } - void Load(BaseStation *bst) const + void Load(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetLoadDescription()); } - void FixPointers(BaseStation *bst) const + void FixPointers(BaseStation *bst) const override { if ((bst->facilities & FACIL_WAYPOINT) == 0) return; SlObject(bst, this->GetDescription()); diff --git a/src/saveload/town_sl.cpp b/src/saveload/town_sl.cpp index 326473688f..228441fa27 100644 --- a/src/saveload/town_sl.cpp +++ b/src/saveload/town_sl.cpp @@ -101,7 +101,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 8323fb67f3..00faa2bcfa 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -624,7 +624,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); @@ -859,14 +859,12 @@ static bool MakeLargeWorldScreenshot(ScreenshotType t, uint32 width = 0, uint32 /** * 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) { @@ -910,10 +908,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, {}); } diff --git a/src/screenshot_gui.cpp b/src/screenshot_gui.cpp index 8e4d395e82..3ef9e7823d 100644 --- a/src/screenshot_gui.cpp +++ b/src/screenshot_gui.cpp @@ -26,12 +26,11 @@ 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; switch (widget) { - default: + default: return; case WID_SC_TAKE: st = SC_VIEWPORT; break; case WID_SC_TAKE_ZOOMIN: st = SC_ZOOMEDIN; break; case WID_SC_TAKE_DEFAULTZOOM: st = SC_DEFAULTZOOM; break; diff --git a/src/script/api/script_asyncmode.hpp b/src/script/api/script_asyncmode.hpp index ba8014b86d..788508ee8d 100644 --- a/src/script/api/script_asyncmode.hpp +++ b/src/script/api/script_asyncmode.hpp @@ -57,7 +57,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_ASYNCMODE_HPP */ diff --git a/src/script/api/script_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/api/script_execmode.hpp b/src/script/api/script_execmode.hpp index f7ea55a1f6..a673a195b2 100644 --- a/src/script/api/script_execmode.hpp +++ b/src/script/api/script_execmode.hpp @@ -48,7 +48,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_EXECMODE_HPP */ diff --git a/src/script/api/script_list.cpp b/src/script/api/script_list.cpp index 80faf00aaf..d5a2500eaf 100644 --- a/src/script/api/script_list.cpp +++ b/src/script/api/script_list.cpp @@ -113,7 +113,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->values.empty()) return 0; this->has_no_more_items = false; @@ -126,7 +126,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; this->item_next = 0; @@ -145,7 +145,7 @@ public: if (this->value_iter != this->list->values.end()) item_next = (*this->value_iter).second; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -154,7 +154,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -165,7 +165,7 @@ public: } } - void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) + void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) override { if (this->IsEnd()) return; @@ -178,12 +178,12 @@ public: } } - void ValueChange(SQInteger item) + void ValueChange(SQInteger item) override { this->ScriptListSorterValueAscending::Remove(item); } - void RetargetIterators() + void RetargetIterators() override { RetargetIterator(this->list->values, this->value_iter); } @@ -210,7 +210,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->values.empty()) return 0; this->has_no_more_items = false; @@ -224,7 +224,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; this->item_next = 0; @@ -248,7 +248,7 @@ public: if (this->value_iter != this->list->values.end()) item_next = this->value_iter->second; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -257,7 +257,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -268,17 +268,17 @@ public: } } - void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) + void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) override { /* not implemented */ } - void ValueChange(SQInteger item) + void ValueChange(SQInteger item) override { this->ScriptListSorterValueDescending::Remove(item); } - void RetargetIterators() + void RetargetIterators() override { RetargetIterator(this->list->values, this->value_iter); } @@ -302,7 +302,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->items.empty()) return 0; this->has_no_more_items = false; @@ -315,7 +315,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; } @@ -333,7 +333,7 @@ public: if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -342,7 +342,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -353,7 +353,7 @@ public: } } - void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) + void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) override { if (this->IsEnd()) return; @@ -366,12 +366,12 @@ public: } } - void ValueChange(SQInteger item) + void ValueChange(SQInteger item) override { /* do nothing */ } - void RetargetIterators() + void RetargetIterators() override { RetargetIterator(this->list->items, this->item_iter); } @@ -398,7 +398,7 @@ public: this->End(); } - SQInteger Begin() + SQInteger Begin() override { if (this->list->items.empty()) return 0; this->has_no_more_items = false; @@ -412,7 +412,7 @@ public: return item_current; } - void End() + void End() override { this->has_no_more_items = true; } @@ -435,7 +435,7 @@ public: if (this->item_iter != this->list->items.end()) item_next = (*this->item_iter).first; } - SQInteger Next() + SQInteger Next() override { if (this->IsEnd()) return 0; @@ -444,7 +444,7 @@ public: return item_current; } - void Remove(SQInteger item) + void Remove(SQInteger item) override { if (this->IsEnd()) return; @@ -455,17 +455,17 @@ public: } } - void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) + void PostErase(SQInteger item, ScriptList::ScriptListMap::iterator post_erase, ScriptList::ScriptListValueSet::iterator value_post_erase) override { /* not implemented */ } - void ValueChange(SQInteger item) + void ValueChange(SQInteger item) override { /* do nothing */ } - void RetargetIterators() + void RetargetIterators() override { RetargetIterator(this->list->items, this->item_iter); } diff --git a/src/script/api/script_testmode.hpp b/src/script/api/script_testmode.hpp index 956a25e2d6..abebc0a6ce 100644 --- a/src/script/api/script_testmode.hpp +++ b/src/script/api/script_testmode.hpp @@ -50,7 +50,7 @@ public: /** * @api -all */ - virtual void FinalRelease(); + void FinalRelease() override; }; #endif /* SCRIPT_TESTMODE_HPP */ diff --git a/src/script/api/script_text.hpp b/src/script/api/script_text.hpp index 5f8acd9f62..dfc295c72b 100644 --- a/src/script/api/script_text.hpp +++ b/src/script/api/script_text.hpp @@ -125,7 +125,7 @@ public: /** * @api -all */ - virtual const std::string GetEncodedText(); + const std::string GetEncodedText() override; private: using ScriptTextRef = ScriptObjectRef; diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index a685d3b0a1..5b823b8dd6 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -103,7 +103,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; @@ -191,7 +191,7 @@ struct ScriptListWindow : 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_SCRL_LIST: { // Select one of the Scripts @@ -229,7 +229,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(); @@ -357,7 +357,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; @@ -436,7 +436,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: { @@ -487,7 +487,7 @@ struct ScriptSettingsWindow : public Window { list.emplace_back(new DropDownListStringItem(config_item.labels.find(i)->second, i, false)); } - ShowDropDownListAt(this, std::move(list), old_val, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), old_val, WID_SCRS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } } else if (IsInsideMM(x, 0, SETTING_BUTTON_WIDTH)) { @@ -541,12 +541,14 @@ struct ScriptSettingsWindow : public Window { void OnDropdownSelect(int widget, int index) override { + if (widget != WID_SCRS_SETTING_DROPDOWN) return; assert(this->clicked_dropdown); SetValue(index); } - void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override + void OnDropdownClose(Point, int widget, int, bool) override { + if (widget != WID_SCRS_SETTING_DROPDOWN) return; /* We cannot raise the dropdown button just yet. OnClick needs some hint, whether * the same dropdown button was clicked again, and then not open the dropdown again. * So, we only remember that it was closed, and process it on the next OnPaint, which is @@ -574,7 +576,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(); HideDropDownMenu(this); @@ -657,7 +659,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 { const char *textfile = GetConfig(slot)->GetTextfile(file_type, slot); if (textfile == nullptr) { @@ -796,7 +798,7 @@ struct ScriptDebugWindow : public Window { this->querystrings[WID_SCRD_BREAK_STR_EDIT_BOX] = &this->break_editbox; - SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN, WIDGET_LIST_END); + SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN); /* Restore the break string value from static variable */ this->break_editbox.text.Assign(this->break_string); @@ -805,7 +807,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; @@ -965,7 +967,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; @@ -1056,7 +1058,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 257b42042b..ecb27d88a0 100644 --- a/src/script/script_scanner.cpp +++ b/src/script/script_scanner.cpp @@ -24,7 +24,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; @@ -165,7 +165,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 buffer[1024]; diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp index 492043c2e9..e77fcf6d77 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_gui.cpp b/src/settings_gui.cpp index 0749b5d55a..63e6916518 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -408,7 +408,7 @@ struct GameOptionsWindow : Window { void SetTab(int widget) { - this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND); this->LowerWidget(widget); int pane = 0; @@ -454,7 +454,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: @@ -505,7 +505,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; @@ -791,7 +791,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); @@ -1060,10 +1060,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 @@ -1086,11 +1086,11 @@ struct SettingEntry : BaseSettingEntry { SettingEntry(const char *name); - virtual void Init(byte level = 0); - virtual void ResetAll(); - virtual uint Length() const; - virtual uint GetMaxHelpHeight(int maxw); - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + void Init(byte level = 0) override; + void ResetAll() override; + uint Length() const override; + uint GetMaxHelpHeight(int maxw) override; + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; void SetButtons(byte new_val); StringID GetHelpText() const; @@ -1103,7 +1103,7 @@ struct SettingEntry : BaseSettingEntry { protected: SettingEntry(const IntSettingDesc *setting); - virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; + virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override; virtual void DrawSettingString(uint left, uint right, int y, bool highlight, int32 value) const; private: @@ -1133,11 +1133,11 @@ struct CargoDestPerCargoSettingEntry : SettingEntry { CargoID cargo; CargoDestPerCargoSettingEntry(CargoID cargo, const IntSettingDesc *setting); - virtual void Init(byte level = 0); - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + void Init(byte level = 0) override; + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; protected: - virtual void DrawSettingString(uint left, uint right, int y, bool highlight, int32 value) const; + void DrawSettingString(uint left, uint right, int y, bool highlight, int32 value) const override; }; /** Conditionally hidden standard setting */ @@ -1147,7 +1147,7 @@ struct ConditionallyHiddenSettingEntry : SettingEntry { ConditionallyHiddenSettingEntry(const char *name, std::function hide_callback) : SettingEntry(name), hide_callback(hide_callback) {} - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; }; /** Containers for BaseSettingEntry */ @@ -1186,23 +1186,23 @@ struct SettingsPage : BaseSettingEntry, SettingsContainer { SettingsPage(StringID title); - virtual void Init(byte level = 0); - virtual void ResetAll(); - virtual void FoldAll(); - virtual void UnFoldAll(); + void Init(byte level = 0) override; + void ResetAll() override; + void FoldAll() override; + void UnFoldAll() override; - virtual uint Length() const; - virtual void GetFoldingState(bool &all_folded, bool &all_unfolded) const; - virtual bool IsVisible(const BaseSettingEntry *item) const; - virtual BaseSettingEntry *FindEntry(uint row, uint *cur_row); - virtual uint GetMaxHelpHeight(int maxw) { return SettingsContainer::GetMaxHelpHeight(maxw); } + uint Length() const override; + void GetFoldingState(bool &all_folded, bool &all_unfolded) const override; + bool IsVisible(const BaseSettingEntry *item) const override; + BaseSettingEntry *FindEntry(uint row, uint *cur_row) override; + uint GetMaxHelpHeight(int maxw) override { return SettingsContainer::GetMaxHelpHeight(maxw); } - virtual bool UpdateFilterState(SettingFilter &filter, bool force_visible); + bool UpdateFilterState(SettingFilter &filter, bool force_visible) override; - virtual uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const; + uint Draw(GameSettings *settings_ptr, int left, int right, int y, uint first_row, uint max_row, BaseSettingEntry *selected, uint cur_row = 0, uint parent_last = 0) const override; protected: - virtual void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const; + void DrawSetting(GameSettings *settings_ptr, int left, int right, int y, bool highlight) const override; }; /* == BaseSettingEntry methods == */ @@ -1908,13 +1908,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); @@ -2615,7 +2613,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: @@ -2796,7 +2794,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: @@ -2923,7 +2921,7 @@ struct GameSettingsWindow : Window { } } - ShowDropDownListAt(this, std::move(list), value, -1, wi_rect, COLOUR_ORANGE); + ShowDropDownListAt(this, std::move(list), value, WID_GS_SETTING_DROPDOWN, wi_rect, COLOUR_ORANGE); } } this->SetDirty(); @@ -3072,23 +3070,21 @@ struct GameSettingsWindow : Window { this->InvalidateData(); break; - default: - if (widget < 0) { - /* Deal with drop down boxes on the panel. */ - assert(this->valuedropdown_entry != nullptr); - const IntSettingDesc *sd = this->valuedropdown_entry->setting; - assert(sd->flags & (SF_GUI_DROPDOWN | SF_ENUM)); + case WID_GS_SETTING_DROPDOWN: + /* Deal with drop down boxes on the panel. */ + assert(this->valuedropdown_entry != nullptr); + const IntSettingDesc *sd = this->valuedropdown_entry->setting; + assert(sd->flags & (SF_GUI_DROPDOWN | SF_ENUM)); - SetSettingValue(sd, index); - this->SetDirty(); - } + SetSettingValue(sd, index); + this->SetDirty(); break; } } void OnDropdownClose(Point pt, int widget, int index, bool instant_close) override { - if (widget >= 0) { + if (widget != WID_GS_SETTING_DROPDOWN) { /* Normally the default implementation of OnDropdownClose() takes care of * a few things. We want that behaviour here too, but only for * "normal" dropdown boxes. The special dropdown boxes added for every @@ -3105,7 +3101,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; @@ -3316,7 +3312,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' */ @@ -3335,7 +3331,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/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index 353f8b0f20..c54224d73e 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -165,7 +165,7 @@ struct SettingsIniFile : IniLoadFile { { } - virtual FILE *OpenFile(const std::string &filename, Subdirectory subdir, size_t *size) + FILE *OpenFile(const std::string &filename, Subdirectory, size_t *size) override { /* Open the text file in binary mode to prevent end-of-line translations * done by ftell() and friends, as defined by K&R. */ @@ -179,7 +179,7 @@ struct SettingsIniFile : IniLoadFile { return in; } - virtual void ReportFileError(const char * const pre, const char * const buffer, const char * const post) + void ReportFileError(const char * const pre, const char * const buffer, const char * const post) override { error("%s%s%s", pre, buffer, post); } diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index b57a6ec5b8..ea54bbd802 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -388,7 +388,7 @@ int Ship::GetEffectiveMaxSpeed() const /** * 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->vehstatus & (VS_HIDDEN | VS_STOPPED)) == 0 ? v : nullptr; } @@ -857,7 +857,7 @@ bool IsShipDestinationTile(TileIndex tile, StationID station) for (DiagDirection d = DIAGDIR_BEGIN; d != DIAGDIR_END; d++) { TileIndex t = tile + TileOffsByDiagDir(d); if (!IsValidTile(t)) continue; - if (IsDockTile(t) && GetStationIndex(t) == station && IsValidDockingDirectionForDock(t, d)) return true; + if (IsDockTile(t) && GetStationIndex(t) == station && IsDockWaterPart(t)) return true; if (IsTileType(t, MP_INDUSTRY)) { const Industry *i = Industry::GetByTile(t); if (i->neutral_station != nullptr && i->neutral_station->index == station) return true; diff --git a/src/signs_gui.cpp b/src/signs_gui.cpp index cec477595c..fd4f875a08 100644 --- a/src/signs_gui.cpp +++ b/src/signs_gui.cpp @@ -228,7 +228,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: { @@ -260,7 +260,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: { @@ -322,7 +322,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 @@ -486,7 +486,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/sl/oldloader_sl.cpp b/src/sl/oldloader_sl.cpp index ad7a6ad13f..07a3211026 100644 --- a/src/sl/oldloader_sl.cpp +++ b/src/sl/oldloader_sl.cpp @@ -634,7 +634,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[] = { @@ -889,7 +889,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); @@ -1094,7 +1094,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) { AllocateMap(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/smallmap_gui.cpp b/src/smallmap_gui.cpp index 98204bebde..5e8689e9bf 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -1397,7 +1397,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) { @@ -1414,7 +1414,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 @@ -1560,7 +1560,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 832e2c7d80..0351c6b016 100644 --- a/src/smallmap_gui.h +++ b/src/smallmap_gui.h @@ -212,7 +212,7 @@ 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; diff --git a/src/sound/allegro_s.h b/src/sound/allegro_s.h index de609f647f..d2ef08366c 100644 --- a/src/sound/allegro_s.h +++ b/src/sound/allegro_s.h @@ -15,19 +15,19 @@ /** Implementation of the allegro sound driver. */ class SoundDriver_Allegro : public SoundDriver { public: - const char *Start(const StringList ¶m); + const char *Start(const StringList ¶m) override; - void Stop(); + void Stop() override; - void MainLoop(); - const char *GetName() const { return "allegro"; } + void MainLoop() override; + const char *GetName() const override { return "allegro"; } }; /** Factory for the allegro sound driver. */ class FSoundDriver_Allegro : public DriverFactoryBase { public: FSoundDriver_Allegro() : DriverFactoryBase(Driver::DT_SOUND, 4, "allegro", "Allegro Sound Driver (param hz,samples)") {} - /* virtual */ Driver *CreateInstance() const { return new SoundDriver_Allegro(); } + Driver *CreateInstance() const override { return new SoundDriver_Allegro(); } }; #endif /* SOUND_ALLEGRO_H */ diff --git a/src/sound/cocoa_s.cpp b/src/sound/cocoa_s.cpp index f5003a23c3..4e2a467b6d 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 470cefd3de..4bde39cff8 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -179,9 +179,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_base.h b/src/station_base.h index acbe556062..d847b64264 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -981,7 +981,7 @@ public: if (!st->TileBelongsToAirport(this->tile)) ++(*this); } - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { (*this).OrthogonalTileIterator::operator++(); while (this->tile != INVALID_TILE && !st->TileBelongsToAirport(this->tile)) { @@ -990,7 +990,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index a3c8c8d571..1332a1ce79 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -209,8 +209,8 @@ enum StationNaming { /** Information to handle station action 0 property 24 correctly */ struct StationNameInformation { - uint32 free_names; ///< Current bitset of free names (we can remove names). - bool *indtypes; ///< Array of bools telling whether an industry type has been found. + uint32_t free_names; ///< Current bitset of free names (we can remove names). + std::bitset indtypes; ///< Bit set indicating when an industry type has been found. }; /** @@ -249,23 +249,22 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n }; const Town *t = st->town; - uint32 free_names = UINT32_MAX; - bool indtypes[NUM_INDUSTRYTYPES]; - memset(indtypes, 0, sizeof(indtypes)); + StationNameInformation sni{}; + sni.free_names = UINT32_MAX; std::bitset extra_names; for (const Station *s : Station::Iterate()) { if ((force_change || s != st) && s->town == t) { if (s->indtype != IT_INVALID) { - indtypes[s->indtype] = true; + sni.indtypes[s->indtype] = true; StringID name = GetIndustrySpec(s->indtype)->station_name; if (name != STR_UNDEFINED) { /* Filter for other industrytypes with the same name */ for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { const IndustrySpec *indsp = GetIndustrySpec(it); - if (indsp->enabled && indsp->station_name == name) indtypes[it] = true; + if (indsp->enabled && indsp->station_name == name) sni.indtypes[it] = true; } } continue; @@ -278,7 +277,7 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n if (str == M(STR_SV_STNAME_FOREST)) { str = M(STR_SV_STNAME_WOODS); } - ClrBit(free_names, str); + ClrBit(sni.free_names, str); } } } @@ -286,7 +285,6 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n st->extra_name_index = UINT16_MAX; TileIndex indtile = tile; - StationNameInformation sni = { free_names, indtypes }; if (CircularTileSearch(&indtile, 7, FindNearIndustryName, &sni)) { /* An industry has been found nearby */ IndustryType indtype = GetIndustryType(indtile); @@ -299,14 +297,13 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n } /* Oil rigs/mines name could be marked not free by looking for a near by industry. */ - free_names = sni.free_names; /* check default names */ - uint32 tmp = free_names & _gen_station_name_bits[name_class]; + uint32 tmp = sni.free_names & _gen_station_name_bits[name_class]; if (tmp != 0) return STR_SV_STNAME + FindFirstBit(tmp); /* check mine? */ - if (HasBit(free_names, M(STR_SV_STNAME_MINES))) { + if (HasBit(sni.free_names, M(STR_SV_STNAME_MINES))) { if (CountMapSquareAround(tile, CMSAMine) >= 2) { return STR_SV_STNAME_MINES; } @@ -314,7 +311,7 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n /* check close enough to town to get central as name? */ const bool is_central = DistanceMax(tile, t->xy) < 8; - if (HasBit(free_names, M(STR_SV_STNAME)) && (is_central || + if (HasBit(sni.free_names, M(STR_SV_STNAME)) && (is_central || DistanceSquare(tile, t->xy) <= std::max(t->cache.squared_town_zone_radius[HZB_TOWN_INNER_SUBURB], t->cache.squared_town_zone_radius[HZB_TOWN_OUTER_SUBURB]))) { return STR_SV_STNAME; } @@ -356,19 +353,19 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n } /* check close enough to town to get central as name? */ - if (is_central && HasBit(free_names, M(STR_SV_STNAME_CENTRAL))) { + if (is_central && HasBit(sni.free_names, M(STR_SV_STNAME_CENTRAL))) { return STR_SV_STNAME_CENTRAL; } /* Check lakeside */ - if (HasBit(free_names, M(STR_SV_STNAME_LAKESIDE)) && + if (HasBit(sni.free_names, M(STR_SV_STNAME_LAKESIDE)) && DistanceFromEdge(tile) < 20 && CountMapSquareAround(tile, CMSAWater) >= 5) { return STR_SV_STNAME_LAKESIDE; } /* Check woods */ - if (HasBit(free_names, M(STR_SV_STNAME_WOODS)) && ( + if (HasBit(sni.free_names, M(STR_SV_STNAME_WOODS)) && ( CountMapSquareAround(tile, CMSATree) >= 8 || CountMapSquareAround(tile, IsTileForestIndustry) >= 2) ) { @@ -379,9 +376,9 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n int z = GetTileZ(tile); int z2 = GetTileZ(t->xy); if (z < z2) { - if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY; + if (HasBit(sni.free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY; } else if (z > z2) { - if (HasBit(free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS; + if (HasBit(sni.free_names, M(STR_SV_STNAME_HEIGHTS))) return STR_SV_STNAME_HEIGHTS; } /* check direction compared to town */ @@ -392,12 +389,28 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n ~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ), }; - free_names &= _direction_and_table[ + sni.free_names &= _direction_and_table[ (TileX(tile) < TileX(t->xy)) + (TileY(tile) < TileY(t->xy)) * 2]; - tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30)); - if (tmp != 0) return STR_SV_STNAME + FindFirstBit(tmp); + /** Bitmask of remaining station names that can be used when a more specific name has not been used. */ + static const uint32_t fallback_names = ( + (1U << M(STR_SV_STNAME_NORTH)) | + (1U << M(STR_SV_STNAME_SOUTH)) | + (1U << M(STR_SV_STNAME_EAST)) | + (1U << M(STR_SV_STNAME_WEST)) | + (1U << M(STR_SV_STNAME_TRANSFER)) | + (1U << M(STR_SV_STNAME_HALT)) | + (1U << M(STR_SV_STNAME_EXCHANGE)) | + (1U << M(STR_SV_STNAME_ANNEXE)) | + (1U << M(STR_SV_STNAME_SIDINGS)) | + (1U << M(STR_SV_STNAME_BRANCH)) | + (1U << M(STR_SV_STNAME_UPPER)) | + (1U << M(STR_SV_STNAME_LOWER)) + ); + + sni.free_names &= fallback_names; + if (sni.free_names != 0) return STR_SV_STNAME + FindFirstBit(sni.free_names); if (check_extra_names()) return STR_SV_STNAME_FALLBACK; @@ -556,7 +569,7 @@ void ClearAllStationCachedNames() * @param st Station to query * @return the expected mask */ -static CargoTypes GetAcceptanceMask(const Station *st) +CargoTypes GetAcceptanceMask(const Station *st) { CargoTypes mask = 0; @@ -566,6 +579,21 @@ static CargoTypes GetAcceptanceMask(const Station *st) return mask; } +/** + * Get a mask of the cargo types that are empty at the station. + * @param st Station to query + * @return the empty mask + */ +CargoTypes GetEmptyMask(const Station *st) +{ + CargoTypes mask = 0; + + for (CargoID i = 0; i < NUM_CARGO; i++) { + if (st->goods[i].CargoTotalCount() == 0) SetBit(mask, i); + } + return mask; +} + /** * Items contains the two cargo names that are to be accepted or rejected. * msg is the string id of the message to display. @@ -1272,10 +1300,9 @@ static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCo * Check whether we can expand the rail part of the given station. * @param st the station to expand * @param new_ta the current (and if all is fine new) tile area of the rail part of the station - * @param axis the axis of the newly build rail * @return Succeeded or failed command. */ -CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis) +CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta) { TileArea cur_ta = st->train_station; @@ -1563,7 +1590,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32 if (ret.Failed()) return ret; if (st != nullptr && st->train_station.tile != INVALID_TILE) { - ret = CanExpandRailStation(st, new_location, axis); + ret = CanExpandRailStation(st, new_location); if (ret.Failed()) return ret; } @@ -3145,20 +3172,6 @@ void ClearDockingTilesCheckingNeighbours(TileIndex tile) } } -/** - * Check if a dock tile can be docked from the given direction. - * @param t Tile index of dock. - * @param d DiagDirection adjacent to dock being tested. (unused) - * @return True iff the dock can be docked from the given direction. - */ -bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d) -{ - assert(IsDockTile(t)); - - StationGfx gfx = GetStationGfx(t); - return gfx >= GFX_DOCK_BASE_WATER_PART; -} - /** * Find the part of a dock that is land-based * @param t Dock tile to find land part of @@ -3376,7 +3389,7 @@ static void DrawTile_Station(TileInfo *ti, DrawTileProcParams params) gfx = GetAirportGfx(ti->tile); if (gfx >= NEW_AIRPORTTILE_OFFSET) { const AirportTileSpec *ats = AirportTileSpec::Get(gfx); - if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), gfx, ats)) { + if (ats->grf_prop.spritegroup[0] != nullptr && DrawNewAirportTile(ti, Station::GetByTile(ti->tile), ats)) { return; } /* No sprite group (or no valid one) found, meaning no graphics associated. @@ -3690,12 +3703,12 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro DrawRailTileSeqInGUI(x, y, t, (st == STATION_WAYPOINT || st == STATION_ROADWAYPOINT) ? 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); } @@ -4899,7 +4912,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_func.h b/src/station_func.h index e2e867320b..a026322377 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -30,6 +30,8 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad); CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted = nullptr); void UpdateStationAcceptance(Station *st, bool show_msg); +CargoTypes GetAcceptanceMask(const Station *st); +CargoTypes GetEmptyMask(const Station *st); const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); @@ -40,7 +42,6 @@ void DeleteOilRig(TileIndex t); void UpdateStationDockingTiles(Station *st); void RemoveDockingTile(TileIndex t); void ClearDockingTilesCheckingNeighbours(TileIndex tile); -bool IsValidDockingDirectionForDock(TileIndex t, DiagDirection d); void UpdateAirportsNoise(); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index bae20c7b06..4265006c19 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -486,7 +486,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 { switch (widget) { case WID_STL_SORTBY: { @@ -622,7 +622,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: { @@ -739,13 +739,15 @@ public: void OnDropdownSelect(int widget, int index) override { - if (this->stations.SortType() != index) { - this->stations.SetSortType(index); + if (widget == WID_STL_SORTDROPBTN) { + if (this->stations.SortType() != index) { + this->stations.SetSortType(index); - /* Display the current sort variant */ - this->GetWidget(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()]; + /* Display the current sort variant */ + this->GetWidget(WID_STL_SORTDROPBTN)->widget_data = this->sorter_names[this->stations.SortType()]; - this->SetDirty(); + this->SetDirty(); + } } } @@ -767,7 +769,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 */ @@ -1500,7 +1502,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: @@ -1636,9 +1638,11 @@ struct StationViewWindow : public Window { void SetStringParameters(int widget) const override { - const Station *st = Station::Get(this->window_number); - SetDParam(0, st->index); - SetDParam(1, st->facilities); + if (widget == WID_SV_CAPTION) { + const Station *st = Station::Get(this->window_number); + SetDParam(0, st->index); + SetDParam(1, st->facilities); + } } /** @@ -2007,11 +2011,7 @@ struct StationViewWindow : public Window { const Station *st = Station::Get(this->window_number); Rect tr = r.Shrink(WidgetDimensions::scaled.framerect); - CargoTypes cargo_mask = 0; - for (CargoID i = 0; i < NUM_CARGO; i++) { - if (HasBit(st->goods[i].status, GoodsEntry::GES_ACCEPTANCE)) SetBit(cargo_mask, i); - } - SetDParam(0, cargo_mask); + SetDParam(0, GetAcceptanceMask(st)); int bottom = DrawStringMultiLine(tr.left, tr.right, tr.top, INT32_MAX, STR_STATION_VIEW_ACCEPTS_CARGO); return CeilDiv(bottom - r.top - WidgetDimensions::scaled.framerect.top, FONT_HEIGHT_NORMAL); } @@ -2094,7 +2094,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: @@ -2345,7 +2345,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) { @@ -2556,7 +2556,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; @@ -2597,7 +2597,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; @@ -2618,7 +2618,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; @@ -2636,7 +2636,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, IsSpecializedStationRightType(this->select_station_cmd)); @@ -2644,7 +2644,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/station_map.h b/src/station_map.h index 9807b62c92..7c6778c233 100644 --- a/src/station_map.h +++ b/src/station_map.h @@ -616,30 +616,13 @@ static inline DiagDirection GetDockDirection(TileIndex t) } /** - * Get the tileoffset from this tile a ship should target to get to this dock. - * @param t Tile to query - * @pre IsTileType(t, MP_STATION) - * @pre IsBuoy(t) || IsOilRig(t) || IsDock(t) - * @return The offset from this tile that should be used as destination for ships. - */ -static inline TileIndexDiffC GetDockOffset(TileIndex t) -{ - static const TileIndexDiffC buoy_offset = {0, 0}; - static const TileIndexDiffC oilrig_offset = {2, 0}; - static const TileIndexDiffC dock_offset[DIAGDIR_END] = { - {-2, 0}, - { 0, 2}, - { 2, 0}, - { 0, -2}, - }; - dbg_assert_tile(IsTileType(t, MP_STATION), t); - - if (IsBuoy(t)) return buoy_offset; - if (IsOilRig(t)) return oilrig_offset; - - dbg_assert_tile(IsDock(t), t); - - return dock_offset[GetDockDirection(t)]; + * Check whether a dock tile is the tile on water. + */ +static inline bool IsDockWaterPart(TileIndex t) +{ + assert(IsDockTile(t)); + StationGfx gfx = GetStationGfx(t); + return gfx >= GFX_DOCK_BASE_WATER_PART; } /** diff --git a/src/statusbar_gui.cpp b/src/statusbar_gui.cpp index 5f616208e1..1ea4f7151b 100644 --- a/src/statusbar_gui.cpp +++ b/src/statusbar_gui.cpp @@ -83,12 +83,12 @@ struct StatusBarWindow : Window { 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) { @@ -179,7 +179,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) { @@ -198,7 +198,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 0340252944..c7a18d8429 100644 --- a/src/story_gui.cpp +++ b/src/story_gui.cpp @@ -754,7 +754,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; @@ -804,7 +804,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: { @@ -860,7 +860,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; @@ -901,7 +901,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.cpp b/src/strgen/strgen.cpp index be73482172..00322461d1 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -367,7 +367,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { free(real_filename); } - void WriteStringID(const char *name, int stringid) + void WriteStringID(const char *name, int stringid) override { if (prev + 1 != stringid) fprintf(this->fh, "\n"); fprintf(this->fh, "static const StringID %s = 0x%X;\n", name, stringid); @@ -375,7 +375,7 @@ struct HeaderFileWriter : HeaderWriter, FileWriter { total_strings++; } - void Finalise(const StringData &data) + void Finalise(const StringData &data) override { /* Find the plural form with the most amount of cases. */ int max_plural_forms = 0; @@ -420,12 +420,12 @@ struct LanguageFileWriter : LanguageWriter, FileWriter { { } - void WriteHeader(const LanguagePackHeader *header) + void WriteHeader(const LanguagePackHeader *header) override { this->Write((const byte *)header, sizeof(*header)); } - void Finalise() + void Finalise() override { if (fputc(0, this->fh) == EOF) { error("Could not write to %s", this->filename); @@ -433,7 +433,7 @@ struct LanguageFileWriter : LanguageWriter, FileWriter { this->FileWriter::Finalise(); } - void Write(const byte *buffer, size_t length) + void Write(const byte *buffer, size_t length) override { if (length == 0) return; if (fwrite(buffer, sizeof(*buffer), length, this->fh) != length) { diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp index e730944d5f..0297ee0c2f 100644 --- a/src/strgen/strgen_base.cpp +++ b/src/strgen/strgen_base.cpp @@ -319,7 +319,7 @@ static void EmitWordList(Buffer *buffer, const char * const *words, uint nw) } } -void EmitPlural(Buffer *buffer, char *buf, int value) +void EmitPlural(Buffer *buffer, char *buf, int) { int argidx = _cur_argidx; int offset = -1; @@ -372,7 +372,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; @@ -524,7 +524,7 @@ StringReader::StringReader(StringData &data, std::string file, bool master, bool { } -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/string.cpp b/src/string.cpp index 229819c9e6..16c7bcecb3 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -1135,14 +1135,14 @@ public: { } - virtual void SetString(const char *s) + void SetString(const char *s) override { this->string = s; this->len = strlen(s); this->cur_pos = 0; } - virtual size_t SetCurPosition(size_t pos) + size_t SetCurPosition(size_t pos) override { dbg_assert(this->string != nullptr && pos <= this->len); /* Sanitize in case we get a position inside an UTF-8 sequence. */ @@ -1150,7 +1150,7 @@ public: return this->cur_pos = pos; } - virtual size_t Next(IterType what) + size_t Next(IterType what) override { dbg_assert(this->string != nullptr); @@ -1188,7 +1188,7 @@ public: return END; } - virtual size_t Prev(IterType what) + size_t Prev(IterType what) override { dbg_assert(this->string != nullptr); diff --git a/src/strings.cpp b/src/strings.cpp index de0729e3df..a5bb541c7b 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -2558,7 +2558,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 f57b6a1890..5307acd5f8 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)); @@ -207,7 +207,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/cargo_const.h b/src/table/cargo_const.h index 51e6818b1d..9d5c4ef0fe 100644 --- a/src/table/cargo_const.h +++ b/src/table/cargo_const.h @@ -27,7 +27,7 @@ * And the following sprite: * - SPR_CARGO_ * - * @param bt Cargo bit number, is #INVALID_CARGO for a non-used spec. + * @param bt Cargo bit number, is #INVALID_CARGO_BITNUM for a non-used spec. * @param label Unique label of the cargo type. * @param colour CargoSpec->legend_colour and CargoSpec->rating_colour. * @param weight Weight of a single unit of this cargo type in 1/16 ton (62.5 kg). @@ -44,9 +44,9 @@ * @param classes Classes of this cargo type. @see CargoClass */ #define MK(bt, label, colour, weight, mult, ip, td1, td2, freight, te, str_plural, str_singular, str_volume, classes) \ - {bt, label, colour, colour, weight, mult, ip, {td1, td2}, freight, te, 0, \ + {label, bt, colour, colour, weight, mult, classes, ip, {td1, td2}, freight, te, 0, \ MK_STR_CARGO_PLURAL(str_plural), MK_STR_CARGO_SINGULAR(str_singular), str_volume, MK_STR_QUANTITY(str_plural), MK_STR_ABBREV(str_plural), \ - MK_SPRITE(str_plural), classes, nullptr, nullptr, 0} + MK_SPRITE(str_plural), nullptr, nullptr, 0} /** Cargo types available by default. */ static const CargoSpec _default_cargo[] = { diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 6f5edb8b54..f63454577e 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -865,7 +865,7 @@ class NIHHouse : public NIHelper { bool ShowExtraInfoOnly(uint index) const override { return HouseSpec::Get(GetHouseType(index))->grf_prop.grffile == nullptr; } bool ShowSpriteDumpButton(uint index) const override { return true; } 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 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? HouseSpec::Get(GetHouseType(index))->grf_prop.grffile->grfid : 0; } @@ -954,7 +954,7 @@ class NIHIndustryTile : public NIHelper { bool IsInspectable(uint index) const override { return GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile != nullptr; } bool ShowSpriteDumpButton(uint index) const override { return true; } 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 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? GetIndustryTileSpec(GetIndustryGfx(index))->grf_prop.grffile->grfid : 0; } @@ -1722,7 +1722,7 @@ static const NIVariable _niv_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 GetGRFID(uint index) const override { return (this->IsInspectable(index)) ? AirportTileSpec::Get(GetAirportGfx(index))->grf_prop.grffile->grfid : 0; } @@ -1773,7 +1773,7 @@ static const NIVariable _niv_airports[] = { NIV_END() }; -class NIHAiport : public NIHelper { +class NIHAirport : public NIHelper { bool IsInspectable(uint index) const override { return AirportSpec::Get(Station::Get(index)->airport.type)->grf_prop.grffile != nullptr; } uint GetParent(uint index) const override { return GetInspectWindowNumber(GSF_FAKE_TOWNS, Station::Get(index)->town->index); } const void *GetInstance(uint index)const override { return Station::Get(index); } @@ -1788,9 +1788,9 @@ class NIHAiport : public NIHelper { return ro.GetScope(VSG_SCOPE_SELF)->GetVariable(var, param, extra); } - 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; @@ -1802,7 +1802,7 @@ static const NIFeature _nif_airport = { nullptr, nullptr, _niv_airports, - new NIHAiport(), + new NIHAirport(), }; @@ -1834,7 +1834,7 @@ class NIHTown : public NIHelper { bool ShowSpriteDumpButton(uint index) const override { return true; } uint GetParent(uint index) 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 GetGRFID(uint index) const override { return 0; } bool PSAWithParameter() const override { return true; } diff --git a/src/tbtr_template_gui_main.cpp b/src/tbtr_template_gui_main.cpp index 74b13a8fc4..7be5be0004 100644 --- a/src/tbtr_template_gui_main.cpp +++ b/src/tbtr_template_gui_main.cpp @@ -367,7 +367,7 @@ public: this->SetWidgetsLoweredState(false, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_TEMPLATE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REFIT_AS_INCOMING, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_REUSE, TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_KEEP, - TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY, WIDGET_LIST_END); + TRW_WIDGET_TMPL_BUTTONS_CONFIGTMPL_OLD_ONLY); } else { const TemplateVehicle *tmp = this->templates[this->selected_template_index]; uint height = ScaleGUITrad(8) + (3 * FONT_HEIGHT_NORMAL); diff --git a/src/terraform_gui.cpp b/src/terraform_gui.cpp index 3fc8d26cbc..caa2f11fd6 100644 --- a/src/terraform_gui.cpp +++ b/src/terraform_gui.cpp @@ -210,7 +210,7 @@ struct TerraformToolbarWindow : Window { /* This is needed as we like to have the tree available on OnInit. */ this->CreateNestedTree(); this->FinishInitNested(window_number); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_TT; } void OnInit() override @@ -221,7 +221,7 @@ struct TerraformToolbarWindow : Window { SetWidgetDisabledState(WID_TT_BUY_LAND, _settings_game.construction.purchase_land_permitted == 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_TT_BUTTONS_START) return; @@ -273,7 +273,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 @@ -320,7 +320,7 @@ 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); } @@ -332,7 +332,7 @@ struct TerraformToolbarWindow : Window { 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) { @@ -576,10 +576,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 @@ -617,7 +616,7 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { this->CreateNestedTree(); this->SetButtonStates(); this->FinishInitNested(window_number); - this->last_user_action = WIDGET_LIST_END; + this->last_user_action = INVALID_WID_ETT; } void OnPaint() override @@ -629,7 +628,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; @@ -654,7 +653,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; @@ -734,14 +733,11 @@ struct ScenarioEditorLandscapeGenerationWindow : Window { { for (uint i = WID_ETT_START; i < this->nested_array_size; i++) { if (i == WID_ETT_BUTTONS_START) i = WID_ETT_BUTTONS_END; // skip the buttons - if (this->IsWidgetLowered(i)) { - this->RaiseWidget(i); - this->SetWidgetDirty(i); - } + this->RaiseWidgetWhenLowered(i); } } - 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 @@ -772,12 +768,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 a89d70fa1f..13c8ce856d 100644 --- a/src/textfile_gui.cpp +++ b/src/textfile_gui.cpp @@ -127,7 +127,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: @@ -517,7 +517,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: @@ -587,7 +587,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; @@ -636,7 +636,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 cecbeb4eae..6f85e9d650 100644 --- a/src/textfile_gui.h +++ b/src/textfile_gui.h @@ -32,8 +32,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 707f161a95..ddcb8e5f0e 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -441,7 +441,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/tilearea_type.h b/src/tilearea_type.h index bdcf6d3e21..11422ecd8b 100644 --- a/src/tilearea_type.h +++ b/src/tilearea_type.h @@ -188,7 +188,7 @@ public: /** * Move ourselves to the next tile in the rectangle on the map. */ - inline TileIterator& operator ++() + inline TileIterator& operator ++() override { assert(this->tile != INVALID_TILE); @@ -203,7 +203,7 @@ public: return *this; } - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } @@ -289,9 +289,9 @@ public: *this = DiagonalTileIterator(DiagonalTileArea(corner1, corner2)); } - TileIterator& operator ++(); + TileIterator& operator ++() override; - virtual std::unique_ptr Clone() const + std::unique_ptr Clone() const override { return std::make_unique(*this); } diff --git a/src/timer/timer_game_tick.cpp b/src/timer/timer_game_tick.cpp index 75ed88d63d..5d9512cc7b 100644 --- a/src/timer/timer_game_tick.cpp +++ b/src/timer/timer_game_tick.cpp @@ -58,7 +58,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/timetable_gui.cpp b/src/timetable_gui.cpp index 6069bdd96a..1b4a8d903d 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -403,7 +403,7 @@ struct TimetableWindow : GeneralVehicleWindow { 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: @@ -427,7 +427,7 @@ struct TimetableWindow : GeneralVehicleWindow { } } - 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; @@ -440,7 +440,7 @@ struct TimetableWindow : GeneralVehicleWindow { * @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: @@ -874,7 +874,7 @@ struct TimetableWindow : GeneralVehicleWindow { } } - 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 53a93146d5..45003a4709 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -114,7 +114,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); @@ -153,12 +153,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; @@ -281,7 +281,7 @@ static CallBackFunction SelectSignTool() /* --- Pausing --- */ -static CallBackFunction ToolbarPauseClick(Window *w) +static CallBackFunction ToolbarPauseClick(Window *) { if (_networking && !(_network_server || _network_settings_access)) return CBF_NONE; // only server can pause the game @@ -294,10 +294,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 @@ -576,10 +575,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; @@ -1010,10 +1008,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; @@ -1033,10 +1030,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; @@ -1082,10 +1078,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; @@ -1477,7 +1472,7 @@ static CallBackFunction ToolbarScenPlaceSign(Window *w) return SelectSignTool(); } -static CallBackFunction ToolbarBtn_NULL(Window *w) +static CallBackFunction ToolbarBtn_NULL(Window *) { return CBF_NONE; } @@ -2185,7 +2180,7 @@ struct MainToolbarWindow : Window { this->timer.SetInterval(MILLISECONDS_PER_TICK); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { MainToolbarScaleAdjuster scale_adjust; @@ -2199,9 +2194,9 @@ struct MainToolbarWindow : Window { /* If spectator, disable all construction buttons * ie : Build road, rail, ships, airports and landscaping * Since enabled state is the default, just disable when needed */ - this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE); /* disable company list drop downs, if there are no companies */ - this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT); this->SetWidgetDisabledState(WID_TN_GOAL, Goal::GetNumItems() == 0); this->SetWidgetDisabledState(WID_TN_STORY, StoryPage::GetNumItems() == 0); @@ -2211,7 +2206,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); } @@ -2284,7 +2279,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: @@ -2329,10 +2324,7 @@ struct MainToolbarWindow : Window { /* We do not want to automatically raise the pause, fast forward and * switchbar buttons; they have to stay down when pressed etc. */ for (uint i = WID_TN_SETTINGS; i < WID_TN_SWITCH_BAR; i++) { - if (this->IsWidgetLowered(i)) { - this->RaiseWidget(i); - this->SetWidgetDirty(i); - } + this->RaiseWidgetWhenLowered(i); } } @@ -2341,7 +2333,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; Window *w = FindWindowById(WC_MAIN_WINDOW, 0); @@ -2578,7 +2570,7 @@ struct ScenarioEditorToolbarWindow : Window { this->timer.SetInterval(MILLISECONDS_PER_TICK); } - void FindWindowPlacementAndResize(int def_width, int def_height) override + void FindWindowPlacementAndResize([[maybe_unused]] int def_width, [[maybe_unused]] int def_height) override { MainToolbarScaleAdjuster scale_adjust; @@ -2622,7 +2614,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: @@ -2636,7 +2628,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); @@ -2684,7 +2676,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: @@ -2710,7 +2702,7 @@ struct ScenarioEditorToolbarWindow : Window { void OnTimeout() override { - this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD); this->SetWidgetDirty(WID_TE_DATE_BACKWARD); this->SetWidgetDirty(WID_TE_DATE_FORWARD); } @@ -2736,7 +2728,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; Window *w = FindWindowById(WC_MAIN_WINDOW, 0); diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 2d016a6ede..2944623742 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -160,9 +160,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); @@ -946,13 +945,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 */ } @@ -1549,11 +1548,10 @@ static inline bool RoadTypesAllowHouseHere(TileIndex t) } /** Test if town can grow road onto a specific tile. - * @param town Town that is building. * @param tile Tile to build upon. * @return true iff the tile's road type don't prevent extending the road. */ -static bool TownCanGrowRoad(const Town *town, TileIndex tile) +static bool TownCanGrowRoad(TileIndex tile) { if (!IsTileType(tile, MP_ROAD)) return true; @@ -1669,7 +1667,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t } } else if (target_dir < DIAGDIR_END && !(cur_rb & DiagDirToRoadBits(ReverseDiagDir(target_dir)))) { - if (!TownCanGrowRoad(t1, tile)) return; + if (!TownCanGrowRoad(tile)) return; /* Continue building on a partial road. * Should be always OK, so we only generate @@ -1812,7 +1810,7 @@ static void GrowTownInTile(TileIndex *tile_ptr, RoadBits cur_rb, DiagDirection t return; } - if (!TownCanGrowRoad(t1, tile)) return; + if (!TownCanGrowRoad(tile)) return; _grow_town_result = GROWTH_SEARCH_STOPPED; } @@ -2481,9 +2479,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); } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 5082d726bd..0ad4ccd0c0 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -345,7 +345,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: { @@ -377,7 +377,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: { @@ -648,7 +648,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 @@ -691,7 +691,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: @@ -756,7 +756,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 */ @@ -1050,7 +1050,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: { @@ -1104,7 +1104,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 @@ -1182,7 +1182,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: @@ -1354,9 +1354,9 @@ public: void UpdateButtons(bool check_availability) { if (check_availability && _game_mode != GM_EDITOR) { - this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE); this->SetWidgetsDisabledState(_settings_game.economy.found_town != TF_CUSTOM_LAYOUT, - WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM, WIDGET_LIST_END); + WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM); if (_settings_game.economy.found_town != TF_CUSTOM_LAYOUT) town_layout = _settings_game.economy.town_layout; } @@ -1393,7 +1393,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: @@ -1445,7 +1445,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); } @@ -1461,7 +1461,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); @@ -2073,7 +2073,7 @@ struct SelectTownWindow : Window { this->FinishInitNested(); } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { if (widget != WID_ST_PANEL) return; @@ -2091,7 +2091,7 @@ struct SelectTownWindow : Window { *size = d; } - virtual void DrawWidget(const Rect &r, int widget) const + void DrawWidget(const Rect &r, int widget) const override { if (widget != WID_ST_PANEL) return; @@ -2105,7 +2105,7 @@ struct SelectTownWindow : Window { } } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { if (widget != WID_ST_PANEL) return; @@ -2120,7 +2120,7 @@ struct SelectTownWindow : Window { this->Close(); } - virtual void OnResize() + void OnResize() override { this->vscroll->SetCapacityFromWidget(this, WID_ST_PANEL, WidgetDimensions::scaled.framerect.Vertical()); } diff --git a/src/tracerestrict_gui.cpp b/src/tracerestrict_gui.cpp index f3de5cadf5..d9f4bce3a3 100644 --- a/src/tracerestrict_gui.cpp +++ b/src/tracerestrict_gui.cpp @@ -3974,8 +3974,7 @@ public: this->SetWidgetsDisabledState(this->vli.index == ALL_TRAINS_TRACE_RESTRICT_SLOT_ID || _local_company != this->vli.company, WID_TRSL_DELETE_SLOT, WID_TRSL_RENAME_SLOT, - WID_TRSL_SET_SLOT_MAX_OCCUPANCY, - WIDGET_LIST_END); + WID_TRSL_SET_SLOT_MAX_OCCUPANCY); /* Disable remaining buttons for non-local companies * Needed while changing _local_company, eg. by cheats @@ -3984,8 +3983,7 @@ public: * so it doesn't have to be disabled */ this->SetWidgetsDisabledState(_local_company != this->vli.company, - WID_TRSL_CREATE_SLOT, - WIDGET_LIST_END); + WID_TRSL_CREATE_SLOT); /* Set text of sort by dropdown */ this->GetWidget(WID_TRSL_SORT_BY_DROPDOWN)->widget_data = this->vehicle_group_none_sorter_names[this->vehgroups.SortType()]; @@ -4515,8 +4513,7 @@ public: this->SetWidgetsDisabledState(this->selected == INVALID_TRACE_RESTRICT_COUNTER_ID || _local_company != this->ctr_company, WID_TRCL_DELETE_COUNTER, WID_TRCL_RENAME_COUNTER, - WID_TRCL_SET_COUNTER_VALUE, - WIDGET_LIST_END); + WID_TRCL_SET_COUNTER_VALUE); /* Disable remaining buttons for non-local companies * Needed while changing _local_company, eg. by cheats @@ -4525,8 +4522,7 @@ public: * so it doesn't have to be disabled */ this->SetWidgetsDisabledState(_local_company != this->ctr_company, - WID_TRCL_CREATE_COUNTER, - WIDGET_LIST_END); + WID_TRCL_CREATE_COUNTER); this->DrawWidgets(); } diff --git a/src/train_gui.cpp b/src/train_gui.cpp index bd64c62dc8..4647dcbae3 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -214,7 +214,7 @@ static void TrainDetailsCargoTab(const CargoSummaryItem *item, int left, int rig SetDParam(3, _settings_game.vehicle.freight_trains); str = FreightWagonMult(item->cargo) > 1 ? STR_VEHICLE_DETAILS_CARGO_FROM_MULT : STR_VEHICLE_DETAILS_CARGO_FROM; } else { - str = item->cargo == INVALID_CARGO ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY; + str = item->cargo == CT_INVALID ? STR_QUANTITY_N_A : STR_VEHICLE_DETAILS_CARGO_EMPTY; } DrawString(left, right, y, str, TC_LIGHT_BLUE); @@ -306,7 +306,7 @@ static void TrainDetailsInfoTab(const Train *v, int left, int right, int y, byte static void TrainDetailsCapacityTab(const CargoSummaryItem *item, int left, int right, int y) { StringID str; - if (item->cargo != INVALID_CARGO) { + if (item->cargo != CT_INVALID) { SetDParam(0, item->cargo); SetDParam(1, item->capacity); SetDParam(4, item->subtype); @@ -332,9 +332,9 @@ static void GetCargoSummaryOfArticulatedVehicle(const Train *v, CargoSummary &su if (!v->GetEngine()->CanCarryCargo()) continue; CargoSummaryItem new_item; - new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : INVALID_CARGO; + new_item.cargo = v->cargo_cap > 0 ? v->cargo_type : (CargoID)CT_INVALID; new_item.subtype = GetCargoSubtypeText(v); - if (new_item.cargo == INVALID_CARGO && new_item.subtype == STR_EMPTY) continue; + if (new_item.cargo == CT_INVALID && new_item.subtype == STR_EMPTY) continue; auto item = std::find(std::begin(summary), std::end(summary), new_item); if (item == std::end(summary)) { diff --git a/src/transparency_gui.cpp b/src/transparency_gui.cpp index 1a38364448..ab11cb8a84 100644 --- a/src/transparency_gui.cpp +++ b/src/transparency_gui.cpp @@ -94,7 +94,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) { @@ -141,7 +141,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 b036d2f638..d7b5ceb8f5 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -771,7 +771,7 @@ static void DrawTile_Trees(TileInfo *ti, DrawTileProcParams params) } -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); @@ -779,7 +779,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; } @@ -1100,12 +1100,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 */ } @@ -1115,7 +1115,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 DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); } diff --git a/src/tree_gui.cpp b/src/tree_gui.cpp index dbd3571bb7..9a13bb76ef 100644 --- a/src/tree_gui.cpp +++ b/src/tree_gui.cpp @@ -141,7 +141,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 */ @@ -160,7 +160,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. @@ -207,7 +207,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); @@ -216,7 +216,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); @@ -231,7 +231,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) { DoCommandP(end_tile, this->tree_to_plant | ((_ctrl_pressed ? 1 : 0) << 8), start_tile, CMD_PLANT_TREE | CMD_MSG(STR_ERROR_CAN_T_PLANT_TREE_HERE)); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index b459293aca..66e728330f 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -349,7 +349,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 e925dddd56..19553b0ea5 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -498,13 +498,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. @@ -518,7 +518,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(); } Direction GetMapImageDirection() const { return this->direction; } @@ -903,7 +903,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 14724ea3c4..ca13dbbb78 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -990,7 +990,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: @@ -1184,7 +1184,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. @@ -2240,9 +2240,6 @@ public: this->vscroll = this->GetScrollbar(WID_VL_SCROLLBAR); - this->BuildVehicleList(); - this->SortVehicleList(); - /* Set up the window widgets */ this->GetWidget(WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->vli.vtype; @@ -2261,6 +2258,9 @@ public: this->FinishInitNested(window_number); if (this->vli.company != OWNER_NONE) this->owner = this->vli.company; + + this->BuildVehicleList(); + this->SortVehicleList(); } void Close() override @@ -2280,7 +2280,7 @@ public: this->RefreshRouteOverlay(); } - 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: @@ -2414,8 +2414,7 @@ public: this->SetWidgetDisabledState(WID_VL_MANAGE_VEHICLES_DROPDOWN, !this->ShouldShowActionDropdownList()); this->SetWidgetsDisabledState(this->owner != _local_company || this->vehicles.size() == 0 || (this->vli.type == VL_STANDARD && _settings_client.gui.disable_top_veh_list_mass_actions), WID_VL_STOP_ALL, - WID_VL_START_ALL, - WIDGET_LIST_END); + WID_VL_START_ALL); } /* Set text of group by dropdown widget. */ @@ -2429,7 +2428,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 @@ -2654,7 +2653,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 */ @@ -2901,7 +2900,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. @@ -3317,8 +3316,7 @@ struct VehicleDetailsWindow : Window { /* Disable service-scroller when interval is set to disabled */ this->SetWidgetsDisabledState(!IsVehicleServiceIntervalEnabled(v->type, v->owner), WID_VD_INCREASE_SERVICING_INTERVAL, - WID_VD_DECREASE_SERVICING_INTERVAL, - WIDGET_LIST_END); + WID_VD_DECREASE_SERVICING_INTERVAL); StringID str = v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT : STR_VEHICLE_DETAILS_DAYS) : @@ -3328,7 +3326,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 @@ -3358,9 +3356,7 @@ struct VehicleDetailsWindow : Window { WID_VD_DETAILS_CARGO_CARRIED, WID_VD_DETAILS_TRAIN_VEHICLES, WID_VD_DETAILS_CAPACITY_OF_EACH, - WID_VD_DETAILS_TOTAL_CARGO, - widget, - WIDGET_LIST_END); + WID_VD_DETAILS_TOTAL_CARGO); this->tab = (TrainDetailsWindowTabs)(widget - WID_VD_DETAILS_CARGO_CARRIED); this->SetDirty(); @@ -3948,7 +3944,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); @@ -4157,7 +4153,7 @@ public: return false; } - 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) { @@ -4209,7 +4205,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. diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm index a1b955d797..17d8c86e5e 100644 --- a/src/video/cocoa/cocoa_v.mm +++ b/src/video/cocoa/cocoa_v.mm @@ -635,7 +635,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 59d451f770..82ef179a29 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 576738dfb2..b7181f9c6b 100644 --- a/src/video/null_v.cpp +++ b/src/video/null_v.cpp @@ -48,7 +48,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() { @@ -74,6 +74,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 b7fa3492be..e4b836eecd 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -407,7 +407,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/sdl2_opengl_v.cpp b/src/video/sdl2_opengl_v.cpp index 8069660f99..4360a0e7e7 100644 --- a/src/video/sdl2_opengl_v.cpp +++ b/src/video/sdl2_opengl_v.cpp @@ -54,7 +54,7 @@ static OGLProc GetOGLProcAddressCallback(const char *proc) bool VideoDriver_SDL_OpenGL::CreateMainWindow(uint w, uint h, uint flags) { - return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, SDL_WINDOW_OPENGL); + return this->VideoDriver_SDL_Base::CreateMainWindow(w, h, flags | SDL_WINDOW_OPENGL); } const char *VideoDriver_SDL_OpenGL::Start(const StringList ¶m) diff --git a/src/video/video_driver.hpp b/src/video/video_driver.hpp index a61db4dccd..d6b79818e4 100644 --- a/src/video/video_driver.hpp +++ b/src/video/video_driver.hpp @@ -77,7 +77,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 abcb082994..c94e7b4145 100644 --- a/src/video/win32_v.cpp +++ b/src/video/win32_v.cpp @@ -945,7 +945,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); @@ -1245,10 +1245,9 @@ static OGLProc GetOGLProcAddressCallback(const char *proc) /** * Set the pixel format of a window- * @param dc Device context to set the pixel format of. - * @param fullscreen Should the pixel format be used for fullscreen drawing? * @return nullptr on success, error message otherwise. */ -static const char *SelectPixelFormat(HDC dc, bool fullscreen) +static const char *SelectPixelFormat(HDC dc) { PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), // Size of this struct. @@ -1289,7 +1288,7 @@ static void LoadWGLExtensions() HDC dc = GetDC(wnd); /* Set pixel format of the window. */ - if (SelectPixelFormat(dc, false) == nullptr) { + if (SelectPixelFormat(dc) == nullptr) { /* Create rendering context. */ HGLRC rc = wglCreateContext(dc); if (rc != nullptr) { @@ -1404,7 +1403,7 @@ const char *VideoDriver_Win32OpenGL::AllocateContext() { this->dc = GetDC(this->main_wnd); - const char *err = SelectPixelFormat(this->dc, this->fullscreen); + const char *err = SelectPixelFormat(this->dc); if (err != nullptr) return err; HGLRC rc = nullptr; diff --git a/src/video/win32_v.h b/src/video/win32_v.h index 4e87e5ec1d..46cff8df92 100644 --- a/src/video/win32_v.h +++ b/src/video/win32_v.h @@ -160,7 +160,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 130c2f1dbb..49d041ab20 100644 --- a/src/viewport_gui.cpp +++ b/src/viewport_gui.cpp @@ -95,7 +95,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; @@ -141,7 +141,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; } @@ -172,7 +172,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 d492eefe8b..0240882901 100644 --- a/src/void_cmd.cpp +++ b/src/void_cmd.cpp @@ -25,7 +25,7 @@ static void DrawTile_Void(TileInfo *ti, DrawTileProcParams params) } -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 2a998f5f7c..a553c4547f 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -198,7 +198,7 @@ void CheckForDockingTile(TileIndex t) TileIndex tile = t + TileOffsByDiagDir(d); if (!IsValidTile(tile)) continue; - if (IsDockTile(tile) && IsValidDockingDirectionForDock(tile, d)) { + if (IsDockTile(tile) && IsDockWaterPart(tile)) { Station *st = Station::GetByTile(tile); st->docking_station.Add(t); st->docking_tiles.push_back(t); @@ -807,7 +807,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); } @@ -997,7 +997,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); @@ -1005,7 +1005,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; } @@ -1414,7 +1414,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}; @@ -1486,12 +1486,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 07e057a5a5..cee2aaf622 100644 --- a/src/waypoint_base.h +++ b/src/waypoint_base.h @@ -47,12 +47,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_cmd.cpp b/src/waypoint_cmd.cpp index 8c7130478e..0225455e98 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -177,7 +177,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID * extern void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const StationSpec *statspec); extern CommandCost FindJoiningWaypoint(StationID existing_station, StationID station_to_join, bool adjacent, TileArea ta, Waypoint **wp, bool is_road); -extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta, Axis axis); +extern CommandCost CanExpandRailStation(const BaseStation *st, TileArea &new_ta); extern CommandCost IsRailStationBridgeAboveOk(TileIndex tile, const StationSpec *statspec, byte layout); /** @@ -269,7 +269,7 @@ CommandCost CmdBuildRailWaypoint(TileIndex start_tile, DoCommandFlag flags, uint /* check if we want to expand an already existing waypoint? */ if (wp->train_station.tile != INVALID_TILE) { - CommandCost ret = CanExpandRailStation(wp, new_location, axis); + CommandCost ret = CanExpandRailStation(wp, new_location); if (ret.Failed()) return ret; } diff --git a/src/waypoint_gui.cpp b/src/waypoint_gui.cpp index a11ffc9eff..db8b7aff73 100644 --- a/src/waypoint_gui.cpp +++ b/src/waypoint_gui.cpp @@ -127,7 +127,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 @@ -166,7 +166,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 5fa4428da6..e57a251934 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -1150,7 +1150,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); } @@ -1703,7 +1703,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); } @@ -1879,17 +1879,17 @@ 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. */ } @@ -1899,7 +1899,7 @@ void NWidgetSpacer::SetDirty(Window *w) /* Spacer widget never need repainting. */ } -NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int x, int y) +NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int, int) { return nullptr; } @@ -2004,7 +2004,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 8bccad627c..2d6904be81 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -20,8 +20,6 @@ #include -static const int WIDGET_LIST_END = -1; ///< indicate the end of widgets' list for vararg functions - /** Bits of the #WWT_MATRIX widget data. */ enum MatrixWidgetValues { /* Number of column bits of the WWT_MATRIX widget data. */ @@ -149,7 +147,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/airport_widget.h b/src/widgets/airport_widget.h index 75b805031c..f923512199 100644 --- a/src/widgets/airport_widget.h +++ b/src/widgets/airport_widget.h @@ -14,6 +14,8 @@ enum AirportToolbarWidgets { WID_AT_AIRPORT, ///< Build airport button. WID_AT_DEMOLISH, ///< Demolish button. + + INVALID_WID_AT = -1, }; /** Widgets of the #BuildAirportWindow class. */ diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 9801983e27..78b84176f7 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -21,7 +21,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]; @@ -40,7 +40,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) | this->colour_flags); @@ -66,7 +66,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); } @@ -76,7 +76,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); diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index 83d989d9d6..a3f04a7b19 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -35,7 +35,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/widgets/game_widget.h b/src/widgets/game_widget.h index 5694bc4607..6ab78fa8e9 100644 --- a/src/widgets/game_widget.h +++ b/src/widgets/game_widget.h @@ -23,6 +23,8 @@ enum GSConfigWidgets { WID_GSC_CONTENT_DOWNLOAD = WID_GSC_TEXTFILE + TFT_CONTENT_END, ///< Download content button. WID_GSC_ACCEPT, ///< Accept ("Close") button WID_GSC_RESET, ///< Reset button. + + WID_GSC_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; #endif /* WIDGETS_GS_WIDGET_H */ diff --git a/src/widgets/newgrf_widget.h b/src/widgets/newgrf_widget.h index 03b81bb584..2d39665447 100644 --- a/src/widgets/newgrf_widget.h +++ b/src/widgets/newgrf_widget.h @@ -26,6 +26,8 @@ enum NewGRFParametersWidgets { WID_NP_RESET, ///< Reset button. WID_NP_SHOW_DESCRIPTION, ///< #NWID_SELECTION to optionally display parameter descriptions. WID_NP_DESCRIPTION, ///< Multi-line description of a parameter. + + WID_NP_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #NewGRFWindow class. */ diff --git a/src/widgets/rail_widget.h b/src/widgets/rail_widget.h index c27b130789..fc5ba35a1b 100644 --- a/src/widgets/rail_widget.h +++ b/src/widgets/rail_widget.h @@ -30,6 +30,8 @@ enum RailToolbarWidgets { WID_RAT_REMOVE, ///< Bulldozer to remove rail. WID_RAT_CONVERT_RAIL, ///< Convert other rail to this type. WID_RAT_CONVERT_RAIL_TRACK, ///< Convert other rail to this type (track). + + INVALID_WID_RAT = -1, }; /** Widgets of the #BuildRailStationWindow class. */ diff --git a/src/widgets/road_widget.h b/src/widgets/road_widget.h index 58e1da6e1c..78b5cefb53 100644 --- a/src/widgets/road_widget.h +++ b/src/widgets/road_widget.h @@ -27,6 +27,8 @@ enum RoadToolbarWidgets { WID_ROT_BUILD_TUNNEL, ///< Build tunnel. WID_ROT_REMOVE, ///< Remove road. WID_ROT_CONVERT_ROAD, ///< Convert road. + + INVALID_WID_ROT = -1, }; /** Widgets of the #BuildRoadDepotWindow class. */ diff --git a/src/widgets/script_widget.h b/src/widgets/script_widget.h index 9c757e12fa..0566995f8d 100644 --- a/src/widgets/script_widget.h +++ b/src/widgets/script_widget.h @@ -29,6 +29,8 @@ enum ScriptSettingsWidgets { WID_SCRS_SCROLLBAR, ///< Scrollbar to scroll through all settings. WID_SCRS_ACCEPT, ///< Accept button. WID_SCRS_RESET, ///< Reset button. + + WID_SCRS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #ScriptDebugWindow class. */ diff --git a/src/widgets/settings_widget.h b/src/widgets/settings_widget.h index 02aa294641..5439e6eb79 100644 --- a/src/widgets/settings_widget.h +++ b/src/widgets/settings_widget.h @@ -65,6 +65,8 @@ enum GameSettingsWidgets { WID_GS_RESTRICT_TYPE, ///< Label upfront to the type drop-down box to restrict the list of settings to show WID_GS_RESTRICT_DROPDOWN, ///< The drop down box to restrict the list of settings WID_GS_TYPE_DROPDOWN, ///< The drop down box to choose client/game/company/all settings + + WID_GS_SETTING_DROPDOWN = -1, ///< Dynamically created dropdown for changing setting value. }; /** Widgets of the #CustomCurrencyWindow class. */ diff --git a/src/widgets/terraform_widget.h b/src/widgets/terraform_widget.h index b715e84b31..c04cdd567c 100644 --- a/src/widgets/terraform_widget.h +++ b/src/widgets/terraform_widget.h @@ -23,6 +23,8 @@ enum TerraformToolbarWidgets { WID_TT_MEASUREMENT_TOOL, ///< Ruler tool button WID_TT_PLACE_SIGN, ///< Place sign button. WID_TT_PLACE_OBJECT, ///< Place object button. + + INVALID_WID_TT = -1, }; /** Widgets of the #ScenarioEditorLandscapeGenerationWindow class. */ @@ -46,6 +48,8 @@ enum EditorTerraformToolbarWidgets { WID_ETT_NEW_SCENARIO, ///< Button for generating a new scenario. WID_ETT_RESET_LANDSCAPE, ///< Button for removing all company-owned property. WID_ETT_PUBLIC_ROADS, ///< Button for creating public roads. + + INVALID_WID_ETT = -1, }; #endif /* WIDGETS_TERRAFORM_WIDGET_H */ diff --git a/src/window.cpp b/src/window.cpp index 6752a4f49c..7bc8bac177 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -539,46 +539,6 @@ void Window::OnFocusLost(bool closing, Window *newly_focused_window) if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxLostFocus(); } -/** - * Sets the enabled/disabled status of a list of widgets. - * By default, widgets are enabled. - * On certain conditions, they have to be disabled. - * @param disab_stat status to use ie: disabled = true, enabled = false - * @param widgets list of widgets ended by WIDGET_LIST_END - */ -void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...) -{ - va_list wdg_list; - - va_start(wdg_list, widgets); - - while (widgets != WIDGET_LIST_END) { - SetWidgetDisabledState(widgets, disab_stat); - widgets = va_arg(wdg_list, int); - } - - va_end(wdg_list); -} - -/** - * Sets the lowered/raised status of a list of widgets. - * @param lowered_stat status to use ie: lowered = true, raised = false - * @param widgets list of widgets ended by WIDGET_LIST_END - */ -void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...) -{ - va_list wdg_list; - - va_start(wdg_list, widgets); - - while (widgets != WIDGET_LIST_END) { - SetWidgetLoweredState(widgets, lowered_stat); - widgets = va_arg(wdg_list, int); - } - - va_end(wdg_list); -} - /** * Raise the buttons of the window. * @param autoraise Raise only the push buttons of the window. diff --git a/src/window_gui.h b/src/window_gui.h index 379860a86c..23fb2f5fa1 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -450,6 +450,18 @@ public: SetWidgetLoweredState(widget_index, false); } + /** + * Marks a widget as raised and dirty (redraw), when it is marked as lowered. + * @param widget_index index of this widget in the window + */ + inline void RaiseWidgetWhenLowered(byte widget_index) + { + if (this->IsWidgetLowered(widget_index)) { + this->RaiseWidget(widget_index); + this->SetWidgetDirty(widget_index); + } + } + /** * Gets the lowered state of a widget. * @param widget_index index of this widget in the window @@ -472,8 +484,40 @@ public: int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const; void RaiseButtons(bool autoraise = false); - void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); - void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); + + /** + * Sets the enabled/disabled status of a list of widgets. + * By default, widgets are enabled. + * On certain conditions, they have to be disabled. + * @param disab_stat status to use ie: disabled = true, enabled = false + * @param widgets list of widgets + */ + template + void SetWidgetsDisabledState(bool disab_stat, Args... widgets) + { + (SetWidgetDisabledState(widgets, disab_stat), ...); + } + + /** + * Sets the lowered/raised status of a list of widgets. + * @param lowered_stat status to use ie: lowered = true, raised = false + * @param widgets list of widgets + */ + template + void SetWidgetsLoweredState(bool lowered_stat, Args... widgets) + { + (SetWidgetLoweredState(widgets, lowered_stat), ...); + } + + /** + * Raises the widgets and sets widgets dirty that are lowered. + * @param widgets list of widgets + */ + template + void RaiseWidgetsWhenLowered(Args... widgets) { + (this->RaiseWidgetWhenLowered(widgets), ...); + } + void SetWidgetDirty(byte widget_index); void DrawWidgets() const; @@ -533,7 +577,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. @@ -547,7 +591,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. @@ -555,7 +599,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 {} virtual void OnFocus(Window *previously_focused_window); @@ -595,7 +639,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. @@ -604,14 +648,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. @@ -619,27 +663,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 @@ -647,13 +691,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) {} /** @@ -676,7 +720,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. @@ -695,7 +739,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); @@ -703,7 +747,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. @@ -711,14 +755,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 @@ -726,7 +770,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. @@ -734,7 +778,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. @@ -742,7 +786,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 clicked on a template vehicle while HT_VEHICLE has been set. @@ -764,7 +808,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 @@ -775,7 +819,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 @@ -784,7 +828,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 ***/ diff --git a/src/zoning_gui.cpp b/src/zoning_gui.cpp index 997842ffe2..e83f01fa71 100644 --- a/src/zoning_gui.cpp +++ b/src/zoning_gui.cpp @@ -83,12 +83,12 @@ struct ZoningWindow : public Window { this->InvalidateData(); } - virtual void OnPaint() + void OnPaint() override { this->DrawWidgets(); } - virtual void OnClick(Point pt, int widget, int click_count) + void OnClick(Point pt, int widget, int click_count) override { switch (widget) { case ZTW_OUTER_DROPDOWN: @@ -101,7 +101,7 @@ struct ZoningWindow : public Window { } } - virtual void OnDropdownSelect(int widget, int index) + void OnDropdownSelect(int widget, int index) override { switch(widget) { case ZTW_OUTER_DROPDOWN: @@ -115,7 +115,7 @@ struct ZoningWindow : public Window { this->InvalidateData(); } - virtual void SetStringParameters(int widget) const + void SetStringParameters(int widget) const override { switch (widget) { case ZTW_OUTER_DROPDOWN: @@ -128,7 +128,7 @@ struct ZoningWindow : public Window { } } - virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) + void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override { const StringID *strs = nullptr; switch (widget) {