From 9c7043d0135bfe7c24221b3defabe2fd8ceb85f1 Mon Sep 17 00:00:00 2001 From: jerrrrycho Date: Sat, 10 Oct 2026 16:03:19 +0200 Subject: [PATCH] refactor(sonar): remove unused variables, captures and private fields (cpp:S1481, cpp:S1068) Co-Authored-By: Claude Opus 5.5 --- McZapkie/Mover.cpp | 9 --------- McZapkie/hamulce.h | 2 -- application/driveruipanels.h | 3 --- environment/moon.cpp | 1 - input/drivermouseinput.cpp | 2 +- rendering/particles.cpp | 1 - vehicle/Train.cpp | 3 +-- 7 files changed, 2 insertions(+), 19 deletions(-) diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index d99160f3..b635553b 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1353,8 +1353,6 @@ void TMoverParameters::Derail(DerailReason const Reason) // ************************************************************************************************* double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track, TTractionParam &ElectricTraction, TLocation const &NewLoc, TRotation const &NewRot) { - const double Vepsilon = 1e-5; - const double Aepsilon = 1e-3; // ASBSpeed=0.8; if (!TestFlag(DamageFlag, dtrain_out)) { // Ra: to przepisywanie tu jest bez sensu @@ -4450,8 +4448,6 @@ void TMoverParameters::UpdatePipePressure(double dt) Pipe->Act(); } - const double LBDelay = 100; - const double kL = 0.5; // double dV; // TMoverParameters *c; // T_MoverParameters double temp; @@ -5161,7 +5157,6 @@ double TMoverParameters::BrakeForce(TTrackParam const & /*Track*/) double K{0}; double Fb{0}; - double sm{0}; switch (LocalBrake) { @@ -6827,7 +6822,6 @@ bool TMoverParameters::AutoRelaySwitch(bool State) bool TMoverParameters::AutoRelayCheck(void) { bool OK = false; // b:int; - bool ARC = false; auto const motorconnectorsoff{false == MotorConnectorsCheck()}; @@ -9585,9 +9579,6 @@ void TMoverParameters::BrakeSubsystemDecode() bool TMoverParameters::LoadFIZ(std::string chkpath) { chkPath = chkpath; // assign class path for reloading - const int param_ok = 1; - const int wheels_ok = 2; - const int dimensions_ok = 4; ConversionError = 666; LISTLINE = 0; diff --git a/McZapkie/hamulce.h b/McZapkie/hamulce.h index dbadb29a..62c89bc0 100644 --- a/McZapkie/hamulce.h +++ b/McZapkie/hamulce.h @@ -1232,7 +1232,6 @@ class TMHZ_K5P : public TDriverHandle /// Time chamber pressure [bar]. double TP = 0.0; // zbiornik czasowy /// Reductor reservoir pressure [bar]. - double RP = 0.0; // zbiornik redukcyjny /// Reductor adjustment offset. double RedAdj = 0.0; // dostosowanie reduktora cisnienia (krecenie kapturkiem) /// True while filling-stroke / release wave is active. @@ -1285,7 +1284,6 @@ class TMHZ_6P : public TDriverHandle /// Time chamber pressure [bar]. double TP = 0.0; // zbiornik czasowy /// Reductor reservoir pressure [bar]. - double RP = 0.0; // zbiornik redukcyjny /// Reductor adjustment offset. double RedAdj = 0.0; // dostosowanie reduktora cisnienia (krecenie kapturkiem) /// True while filling-stroke / release wave is active. diff --git a/application/driveruipanels.h b/application/driveruipanels.h index 84aec269..96b9ac1c 100644 --- a/application/driveruipanels.h +++ b/application/driveruipanels.h @@ -54,7 +54,6 @@ public: private: // members - std::array m_buffer; TDynamicObject const *m_nearest { nullptr }; }; @@ -133,8 +132,6 @@ private: graph_data AccN_acc_graph; float last_AccN; - std::array queue_event_buf = { 0 }; - std::array queue_event_activator_buf = { 0 }; bool m_eventqueueactivevehicleonly { false }; }; diff --git a/environment/moon.cpp b/environment/moon.cpp index 4f9b6123..4c38b6c9 100644 --- a/environment/moon.cpp +++ b/environment/moon.cpp @@ -263,7 +263,6 @@ void cMoon::refract() { void cMoon::irradiance() { - static double radtodeg = 57.295779513; // converts from radians to degrees static double degtorad = 0.0174532925; // converts from degrees to radians m_body.dayang = ( simulation::Time.year_day() - 1 ) * 360.0 / 365.0; diff --git a/input/drivermouseinput.cpp b/input/drivermouseinput.cpp index 40bf969d..ae067507 100644 --- a/input/drivermouseinput.cpp +++ b/input/drivermouseinput.cpp @@ -314,7 +314,7 @@ drivermouse_input::button( int const Button, int const Action ) { // left mouse button launches on_click event associated with to the node if (Button == GLFW_MOUSE_BUTTON_LEFT && Action == GLFW_PRESS) { GfxRenderer->Pick_Node_Callback( - [this](scene::basic_node *node) { + [](scene::basic_node *node) { if( node == nullptr || typeid(*node) != typeid(TAnimModel) ) return; diff --git a/rendering/particles.cpp b/rendering/particles.cpp index 78eacc19..4cbbc62c 100644 --- a/rendering/particles.cpp +++ b/rendering/particles.cpp @@ -332,7 +332,6 @@ smoke_source::initialize( smoke_particle &Particle ) { if( m_ownertype == owner_type::vehicle ) { Particle.opacity *= static_cast(m_owner.vehicle->MoverParameters->dizel_fill); - auto const enginerevolutionsfactor { 1.5f }; // high engine revolutions increase initial particle velocity switch( m_owner.vehicle->MoverParameters->EngineType ) { case TEngineType::DieselElectric: { if (m_owner.vehicle->MoverParameters->dizel_spinup == true) diff --git a/vehicle/Train.cpp b/vehicle/Train.cpp index 91d494a7..f8a5f14c 100644 --- a/vehicle/Train.cpp +++ b/vehicle/Train.cpp @@ -6886,7 +6886,6 @@ void TTrain::OnCommand_speedcontrolbutton(TTrain *Train, command_data const &Com { auto const itemindex = static_cast(Command.command) - static_cast(user_command::speedcontrolbutton0); - auto &item = Train->ggSpeedCtrlButtons[itemindex]; if (Command.action == GLFW_PRESS) { @@ -11448,7 +11447,7 @@ void TTrain::set_cab_controls(int const Cab) bool kier = DynamicObject->DirectionGet() * mvOccupied->CabOccupied > 0; int flag = DynamicObject->MoverParameters->InverterControlCouplerFlag; int itemstart = 0; - for (auto &item : ggInverterToggleButtons) // for each button + for ([[maybe_unused]] auto &item : ggInverterToggleButtons) // for each button { int itemindex = itemstart; itemstart++;