17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-06 18:38:36 +01:00

refactor(sonar): remove dead stores (cpp:S1854)

Side effects (e.g. LISTLINE++) are kept.
This commit is contained in:
jerrrrycho
2026-10-10 15:58:05 +02:00
parent 4b55445a53
commit d28695f073
8 changed files with 7 additions and 48 deletions

View File

@@ -350,7 +350,6 @@ double TMoverParameters::Current(double n, double U)
Mn = RList[MainCtrlActualPos].Mn * RList[MainCtrlActualPos].Bn; Mn = RList[MainCtrlActualPos].Mn * RList[MainCtrlActualPos].Bn;
if (RList[MainCtrlActualPos].Bn > 1) if (RList[MainCtrlActualPos].Bn > 1)
{ {
Bn = 1;
R = CircuitRes; R = CircuitRes;
} }
} }
@@ -432,7 +431,6 @@ double TMoverParameters::Current(double n, double U)
if (DynamicBrakeType == dbrake_switch && (BrakePress > 2.0 || PipePress < 3.6)) if (DynamicBrakeType == dbrake_switch && (BrakePress > 2.0 || PipePress < 3.6))
{ {
Im = 0; Im = 0;
MotorCurrent = 0;
// Im:=0; // Im:=0;
Itot = 0; Itot = 0;
} }
@@ -4556,7 +4554,6 @@ void TMoverParameters::UpdatePipePressure(double dt)
// ulepszony hamulec bezp. // ulepszony hamulec bezp.
EmergencyValveFlow = 0.0; EmergencyValveFlow = 0.0;
auto const lowvoltagepower{Power24vIsAvailable || Power110vIsAvailable};
// EngDmgFlag 32 (load destroyed) used to trigger this too; dropped, it has nothing to do with // EngDmgFlag 32 (load destroyed) used to trigger this too; dropped, it has nothing to do with
// the emergency brake (a broken coupler sets AlarmChainFlag instead) // the emergency brake (a broken coupler sets AlarmChainFlag instead)
@@ -5903,7 +5900,6 @@ double TMoverParameters::TractionForce(double dt)
auto power = Power; auto power = Power;
tempImax = DElist[MainCtrlPos].Imax; tempImax = DElist[MainCtrlPos].Imax;
tempUmax = DElist[MainCtrlPos].Umax; tempUmax = DElist[MainCtrlPos].Umax;
tempPmax = DElist[MainCtrlPos].GenPower;
if (true == Heating) if (true == Heating)
{ {
power -= HeatingPower; power -= HeatingPower;
@@ -6361,7 +6357,6 @@ double TMoverParameters::TractionForce(double dt)
// (Hamulec as TLSt).SetLBP(LocBrakePress); // (Hamulec as TLSt).SetLBP(LocBrakePress);
tmp = 4; // szybkie malenie, powolne wzrastanie tmp = 4; // szybkie malenie, powolne wzrastanie
} }
dmoment = eimv[eimv_Fful];
// NOTE: the commands to operate the sandbox are likely to conflict with other similar ai decisions // NOTE: the commands to operate the sandbox are likely to conflict with other similar ai decisions
// TODO: gather these in single place so they can be resolved together // TODO: gather these in single place so they can be resolved together
if (SlippingWheels) if (SlippingWheels)
@@ -7988,7 +7983,6 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
friction = dizel_engagefriction; friction = dizel_engagefriction;
hydro_TC_nIn = enrot; // wal wejsciowy przetwornika momentu hydro_TC_nIn = enrot; // wal wejsciowy przetwornika momentu
hydro_TC_nOut = dizel_n_old; // wal wyjsciowy przetwornika momentu hydro_TC_nOut = dizel_n_old; // wal wyjsciowy przetwornika momentu
neps = (n - dizel_n_old) / dt; // przyspieszenie katowe walu wejsciowego skrzyni biegow
if (enrot > 0) if (enrot > 0)
{ {
@@ -8132,7 +8126,6 @@ double TMoverParameters::dizel_Momentum(double dizel_fill, double n, double dt)
{ {
dizel_engagedeltaomega = 0; dizel_engagedeltaomega = 0;
gearMoment = Moment; gearMoment = Moment;
enMoment = 0;
double enrot_min = enrot - (std::min(TorqueC, TorqueL + abs(hydro_TC_TorqueIn)) - Moment) / dizel_AIM * dt; double enrot_min = enrot - (std::min(TorqueC, TorqueL + abs(hydro_TC_TorqueIn)) - Moment) / dizel_AIM * dt;
double enrot_max = enrot + (std::min(TorqueC, TorqueL + abs(hydro_TC_TorqueIn)) + Moment) / dizel_AIM * dt; double enrot_max = enrot + (std::min(TorqueC, TorqueL + abs(hydro_TC_TorqueIn)) + Moment) / dizel_AIM * dt;
enrot = safe_clamp(n, enrot_min, enrot_max); enrot = safe_clamp(n, enrot_min, enrot_max);
@@ -9289,7 +9282,7 @@ bool TMoverParameters::readDMList(std::string const &line)
WriteLog("Read DMList: arguments missing in line " + std::to_string(LISTLINE + 1)); WriteLog("Read DMList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false; return false;
} }
auto idx = LISTLINE++; ++LISTLINE;
double x = 0.0; double x = 0.0;
double y = 0.0; double y = 0.0;
parser >> x >> y; parser >> x >> y;
@@ -9309,7 +9302,7 @@ bool TMoverParameters::readV2NMAXList(std::string const &line)
WriteLog("Read V2nmaxList: arguments missing in line " + std::to_string(LISTLINE + 1)); WriteLog("Read V2nmaxList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false; return false;
} }
auto idx = LISTLINE++; ++LISTLINE;
double x = 0.0; double x = 0.0;
double y = 0.0; double y = 0.0;
parser >> x >> y; parser >> x >> y;
@@ -9329,7 +9322,7 @@ bool TMoverParameters::readHTCList(std::string const &line)
WriteLog("Read HTCList: arguments missing in line " + std::to_string(LISTLINE + 1)); WriteLog("Read HTCList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false; return false;
} }
auto idx = LISTLINE++; ++LISTLINE;
double x = 0.0; double x = 0.0;
double y = 0.0; double y = 0.0;
parser >> x >> y; parser >> x >> y;
@@ -9349,7 +9342,7 @@ bool TMoverParameters::readPmaxList(std::string const &line)
WriteLog("Read PmaxList: arguments missing in line " + std::to_string(LISTLINE + 1)); WriteLog("Read PmaxList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false; return false;
} }
auto idx = LISTLINE++; ++LISTLINE;
double x = 0.0; double x = 0.0;
double y = 0.0; double y = 0.0;
parser >> x >> y; parser >> x >> y;
@@ -9426,7 +9419,7 @@ bool TMoverParameters::readDimmerList(std::string const &line)
WriteLog("Read DimmerList: arguments missing in line " + std::to_string(LISTLINE + 1)); WriteLog("Read DimmerList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false; return false;
} }
int idx = LISTLINE++; ++LISTLINE;
dimPosition dps; dimPosition dps;
parser >> dps.isHighBeam >> dps.isDimmed >> dps.isOff; parser >> dps.isHighBeam >> dps.isDimmed >> dps.isOff;

View File

@@ -334,7 +334,6 @@ double TNESt3::GetCRP()
void TNESt3::CheckState(double const BCP, double & /*dV1*/) // glowny przyrzad rozrzadczy void TNESt3::CheckState(double const BCP, double & /*dV1*/) // glowny przyrzad rozrzadczy
{ {
double const BVP{ BrakeRes->P() }; //-> tu ma byc komora rozprezna
double const VVP{ ValveRes->P() }; double const VVP{ ValveRes->P() };
double const CVP{ CntrlRes->P() }; double const CVP{ CntrlRes->P() };
double const MPP{ Miedzypoj->P() }; double const MPP{ Miedzypoj->P() };

View File

@@ -707,7 +707,6 @@ double TWest::GetPF(double const PP, double const dt, double const Vel)
temp = BVP * int(EPS > 0); temp = BVP * int(EPS > 0);
dv = PF(temp, LBP, 0.0015) * dt * EPS * EPS * int(LBP * EPS < MaxBP * LoadC); dv = PF(temp, LBP, 0.0015) * dt * EPS * EPS * int(LBP * EPS < MaxBP * LoadC);
LBP = LBP - dv; LBP = LBP - dv;
dv = 0;
// przeplyw ZP <-> silowniki // przeplyw ZP <-> silowniki
if ((BrakeStatus & b_on) == b_on && (TareBP < 0.1 || BCP < MaxBP * LoadC)) if ((BrakeStatus & b_on) == b_on && (TareBP < 0.1 || BCP < MaxBP * LoadC))
@@ -783,7 +782,6 @@ void TWest::SetEPS(double const nEPS)
{ {
double BCP; double BCP;
BCP = BrakeCyl->P();
if (nEPS > 0) if (nEPS > 0)
DCV = true; DCV = true;
else if (nEPS == 0 && EPS != 0) else if (nEPS == 0 && EPS != 0)
@@ -855,7 +853,6 @@ void TESt::CheckState(double const BCP, double & /*dV1*/)
{ {
double const VVP{ValveRes->P()}; double const VVP{ValveRes->P()};
double const BVP{BrakeRes->P()};
double const CVP{CntrlRes->P()}; double const CVP{CntrlRes->P()};
// sprawdzanie stanu // sprawdzanie stanu
@@ -997,11 +994,8 @@ double TESt::GetPF(double const PP, double const dt, double const Vel)
double CVP; double CVP;
BVP = BrakeRes->P(); BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = BrakeCyl->P(); BCP = BrakeCyl->P();
CVP = CntrlRes->P() - 0.0;
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -1157,7 +1151,6 @@ double TEStEP2::GetPF(double const PP, double const dt, double const Vel)
BCP = ImplsRes->P(); BCP = ImplsRes->P();
CVP = CntrlRes->P(); // 110115 - konsultacje warszawa1 CVP = CntrlRes->P(); // 110115 - konsultacje warszawa1
dv = 0;
dV1 = 0; dV1 = 0;
// odluzniacz // odluzniacz
@@ -1340,9 +1333,9 @@ void TEStEP1::SetEPS(double const nEPS)
double TESt3::GetPF(double const PP, double const dt, double const Vel) double TESt3::GetPF(double const PP, double const dt, double const Vel)
{ {
double BVP{BrakeRes->P()}; double BVP{BrakeRes->P()};
double VVP{ValveRes->P()}; double VVP;
double BCP{BrakeCyl->P()}; double BCP{BrakeCyl->P()};
double CVP{CntrlRes->P() - 0.0}; double CVP;
double dv{0.0}; double dv{0.0};
double dV1{0.0}; double dV1{0.0};
@@ -1417,11 +1410,8 @@ double TESt4R::GetPF(double const PP, double const dt, double const Vel)
double CVP; double CVP;
BVP = BrakeRes->P(); BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = ImplsRes->P(); BCP = ImplsRes->P();
CVP = CntrlRes->P();
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -1540,11 +1530,9 @@ double TESt3AL2::GetPF(double const PP, double const dt, double const Vel)
double CVP; double CVP;
BVP = BrakeRes->P(); BVP = BrakeRes->P();
VVP = ValveRes->P();
BCP = ImplsRes->P(); BCP = ImplsRes->P();
CVP = CntrlRes->P() - 0.0; CVP = CntrlRes->P() - 0.0;
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -2239,11 +2227,9 @@ double TCV1::GetPF(double const PP, double const dt, double const Vel)
double CVP; double CVP;
BVP = BrakeRes->P(); BVP = BrakeRes->P();
VVP = std::min(ValveRes->P(), BVP + 0.05);
BCP = BrakeCyl->P(); BCP = BrakeCyl->P();
CVP = CntrlRes->P(); CVP = CntrlRes->P();
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -2398,11 +2384,9 @@ double TCV1L_TR::GetPF(double const PP, double const dt, double const Vel)
double CVP; double CVP;
BVP = BrakeRes->P(); BVP = BrakeRes->P();
VVP = std::min(ValveRes->P(), BVP + 0.05);
BCP = ImplsRes->P(); BCP = ImplsRes->P();
CVP = CntrlRes->P(); CVP = CntrlRes->P();
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -2504,7 +2488,6 @@ void TKE::CheckState(double const BCP, double & /*dV1*/)
double BVP; double BVP;
double CVP; double CVP;
BVP = BrakeRes->P();
VVP = ValveRes->P(); VVP = ValveRes->P();
CVP = CntrlRes->P(); CVP = CntrlRes->P();
@@ -2580,7 +2563,6 @@ double TKE::CVs(double const BP) const
double BVP; double BVP;
double CVP; double CVP;
BVP = BrakeRes->P();
CVP = CntrlRes->P(); CVP = CntrlRes->P();
VVP = ValveRes->P(); VVP = ValveRes->P();
@@ -2647,7 +2629,6 @@ double TKE::GetPF(double const PP, double const dt, double const Vel)
IMP = ImplsRes->P(); IMP = ImplsRes->P();
CVP = CntrlRes->P(); CVP = CntrlRes->P();
dv = 0;
dV1 = 0; dV1 = 0;
// sprawdzanie stanu // sprawdzanie stanu
@@ -3032,7 +3013,6 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
int const LBDelay{100}; int const LBDelay{100};
double const xpM{0.3}; // mnoznik membrany komory pod double const xpM{0.3}; // mnoznik membrany komory pod
ep = PP / 2.0 * 1.5 + ep / 2.0 * 0.5; // SPKS!!
for (int idx = 0; idx < 5; ++idx) for (int idx = 0; idx < 5; ++idx)
{ {
@@ -3275,7 +3255,6 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
Sounds[idx] = 0; Sounds[idx] = 0;
} }
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 9.999); // na wszelki wypadek, zeby nie wyszlo poza zakres i_bcp = std::clamp(i_bcp, -0.999, 9.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3482,7 +3461,6 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
Sounds[idx] = 0; Sounds[idx] = 0;
} }
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 2.999); // na wszelki wypadek, zeby nie wyszlo poza zakres i_bcp = std::clamp(i_bcp, -0.999, 2.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3503,7 +3481,6 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
LimCP = 3.4; LimCP = 3.4;
else // luzowanie else // luzowanie
LimCP = 5.0; LimCP = 5.0;
pom = CP;
LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie
ActFlowSpeed = 4; ActFlowSpeed = 4;
@@ -3661,7 +3638,6 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
Sounds[idx] = 0; Sounds[idx] = 0;
} }
DP = 0;
i_bcp = std::clamp(i_bcp, -0.999, 3.999); // na wszelki wypadek, zeby nie wyszlo poza zakres i_bcp = std::clamp(i_bcp, -0.999, 3.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -3682,7 +3658,6 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
LimCP = 3.4; LimCP = 3.4;
else // luzowanie else // luzowanie
LimCP = 5.0; LimCP = 5.0;
pom = CP;
LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie LimCP = std::min(LimCP, HP); // pozycja + czasowy lub zasilanie
ActFlowSpeed = 4; ActFlowSpeed = 4;

View File

@@ -179,10 +179,8 @@ void cMoon::move() {
double const pertvariation = +0.658 * std::sin( degtorad * ( 2.0 * mnelong ) ); // Variation double const pertvariation = +0.658 * std::sin( degtorad * ( 2.0 * mnelong ) ); // Variation
double const pertyearlyeqt = -0.186 * std::sin( degtorad * sunmnanom ); // Yearly equation double const pertyearlyeqt = -0.186 * std::sin( degtorad * sunmnanom ); // Yearly equation
// latitude perturbations // latitude perturbations
double const pertlat = -0.173 * std::sin( degtorad * ( arglat - 2.0 * mnelong ) );
m_body.eclong += pertevection + pertvariation + pertyearlyeqt; m_body.eclong += pertevection + pertvariation + pertyearlyeqt;
ecliplat += pertlat;
// declination // declination
m_body.declin = radtodeg * std::asin( std::sin (m_body.oblecl * degtorad) * std::sin(m_body.eclong * degtorad) ); m_body.declin = radtodeg * std::asin( std::sin (m_body.oblecl * degtorad) * std::sin(m_body.eclong * degtorad) );

View File

@@ -61,7 +61,6 @@ mouse_slider::bind( user_command const &Command ) {
vehicle->MainCtrlPosNo + vehicle->ScndCtrlPosNo : vehicle->MainCtrlPosNo + vehicle->ScndCtrlPosNo :
vehicle->MainCtrlPosNo ) }; vehicle->MainCtrlPosNo ) };
// for simplicity upper half of the range controls power, lower controls brakes // for simplicity upper half of the range controls power, lower controls brakes
auto const brakerangemultiplier { powerrange / LocalBrakePosNo };
m_valuerange = 1.0; m_valuerange = 1.0;
m_value = m_value =

View File

@@ -315,7 +315,6 @@ basic_controller::run() -> int {
break; break;
} }
auto &target { element( operation.element ) }; auto &target { element( operation.element ) };
auto const initialstate { target.input() };
target.input() = m_accumulator.back(); target.input() = m_accumulator.back();
// additional operations for advanced element types // additional operations for advanced element types
switch( (basic_element::type_e)target.data.index() ) { switch( (basic_element::type_e)target.data.index() ) {

View File

@@ -8207,7 +8207,6 @@ void TTrain::OnCommand_cabchangeforward(TTrain *Train, command_data const &Comma
if (Command.action == GLFW_PRESS) if (Command.action == GLFW_PRESS)
{ {
auto const *owner{(Train->DynamicObject->ctOwner != nullptr ? Train->DynamicObject->ctOwner : Train->DynamicObject->Mechanik)};
if (auto const movedirection{1}; false == Train->CabChange(movedirection)) if (auto const movedirection{1}; false == Train->CabChange(movedirection))
{ {
auto const exitdirection{(movedirection > 0 ? end::front : end::rear)}; auto const exitdirection{(movedirection > 0 ? end::front : end::rear)};
@@ -8237,7 +8236,6 @@ void TTrain::OnCommand_cabchangebackward(TTrain *Train, command_data const &Comm
if (Command.action == GLFW_PRESS) if (Command.action == GLFW_PRESS)
{ {
auto const *owner{(Train->DynamicObject->ctOwner != nullptr ? Train->DynamicObject->ctOwner : Train->DynamicObject->Mechanik)};
if (auto const movedirection{-1}; false == Train->CabChange(movedirection)) if (auto const movedirection{-1}; false == Train->CabChange(movedirection))
{ {
// current vehicle doesn't extend any farther in this direction, check if we there's one connected we can move to // current vehicle doesn't extend any farther in this direction, check if we there's one connected we can move to
@@ -10312,7 +10310,6 @@ bool TTrain::LoadMMediaFile(std::string const &asFileName)
rsHuntingNoise->m_frequencyfactor /= static_cast<float>(1 + mvOccupied->Vmax); rsHuntingNoise->m_frequencyfactor /= static_cast<float>(1 + mvOccupied->Vmax);
} }
} }
auto const nullvector{glm::vec3()};
std::vector<std::reference_wrapper<std::optional<sound_source>>> sounds = { std::vector<std::reference_wrapper<std::optional<sound_source>>> sounds = {
dsbReverserKey, dsbNastawnikJazdy, dsbNastawnikBocz, dsbSwitch, dsbPneumaticSwitch, rsHiss, rsHissU, rsHissE, rsHissX, rsHissT, rsSBHiss, dsbReverserKey, dsbNastawnikJazdy, dsbNastawnikBocz, dsbSwitch, dsbPneumaticSwitch, rsHiss, rsHissU, rsHissE, rsHissX, rsHissT, rsSBHiss,
rsSBHissU, rsFadeSound, rsRunningNoise, rsResonanceNoise, rsWindSound, rsHuntingNoise, dsbHasler, dsbBuzzer, dsbBuzzerShp, dsbSlipAlarm, m_distancecounterclear, rsSBHissU, rsFadeSound, rsRunningNoise, rsResonanceNoise, rsWindSound, rsHuntingNoise, dsbHasler, dsbBuzzer, dsbBuzzerShp, dsbSlipAlarm, m_distancecounterclear,

View File

@@ -262,7 +262,6 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
} }
else else
{ {
ConversionError = 666;
vActual = -1; vActual = -1;
s = scnpath + TrainName + ".txt"; s = scnpath + TrainName + ".txt";
replace_slashes(s); replace_slashes(s);