17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-30 21:20:28 +01:00

refactor(sonar): clean up issues reported on PR 209

- remove locals left unused after the dead-store cleanup (cpp:S1481, cpp:S1854)
- unnamed unused parameter (cpp:S1172)
- single-use declarations moved into if init-statements (cpp:S6004)
- auto for casted initialisers (cpp:S5827)
- const references and pointers where nothing is modified (cpp:S5350)
- rename structured bindings shadowed by inner declarations (cpp:S1117)
This commit is contained in:
jerrrrycho
2026-10-11 01:41:01 +02:00
parent 555e5f0aab
commit 2b74c6dba7
17 changed files with 37 additions and 50 deletions

View File

@@ -758,8 +758,7 @@ std::shared_ptr<dictionary_source> TTrain::GetTrainState(dictionary_source const
dict->insert("dir_brake", bEP);
bool bPN{false};
auto const &brakevalve{*mvOccupied->Hamulec};
auto const &brakevalvetype{typeid(brakevalve)};
if (brakevalvetype == typeid(TLSt) || brakevalvetype == typeid(TEStED))
if (auto const &brakevalvetype{typeid(brakevalve)}; brakevalvetype == typeid(TLSt) || brakevalvetype == typeid(TEStED))
{
TBrake *temp_ham = mvOccupied->Hamulec.get();
@@ -6792,7 +6791,7 @@ void TTrain::OnCommand_springbrakerelease(TTrain *Train, command_data const &Com
{
// only reacting to press, so the switch doesn't flip back and forth if key is held down
if (auto *vehicle{Train->find_nearest_consist_vehicle(Command.freefly, Command.location)}; vehicle == nullptr)
if (auto const *vehicle{Train->find_nearest_consist_vehicle(Command.freefly, Command.location)}; vehicle == nullptr)
{
return;
}