17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-04 11:19:30 +01:00

refactor(sonar): remove empty statements, one declaration per statement (cpp:S1116, cpp:S1659)

This commit is contained in:
jerrrrycho
2026-10-10 15:03:30 +02:00
parent 3d46090e49
commit c4738dbc87
35 changed files with 315 additions and 180 deletions

View File

@@ -14,7 +14,9 @@ http://mozilla.org/MPL/2.0/.
class AirCoupler
{
private:
TSubModel *ModelOn, *ModelOff, *ModelxOn;
TSubModel *ModelOn;
TSubModel *ModelOff;
TSubModel *ModelxOn;
bool On;
bool xOn;
void Update();

View File

@@ -51,7 +51,7 @@ void TButton::Load( cParser &Parser, TDynamicObject const *Owner ) {
// TODO: rework the base part into yaml-compatible flow style mapping
submodelname = Parser.getToken<std::string>( false );
while( true == Load_mapping( Parser ) ) {
; // all work done by while()
// all work done by while()
}
}

View File

@@ -48,9 +48,8 @@ private:
play();
// members
TSubModel
*pModelOn { nullptr },
*pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego
TSubModel *pModelOn { nullptr };
TSubModel *pModelOff { nullptr }; // submodel dla stanu załączonego i wyłączonego
bool m_state { false };
bool const *bData { nullptr };
int iFeedbackBit { 0 }; // Ra: bit informacji zwrotnej, do wyprowadzenia na pulpit

View File

@@ -97,8 +97,13 @@ void TGauge::Init(TSubModel *Submodel, TSubModel *Submodelon, TGaugeAnimation Ty
void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mul ) {
std::string submodelname, gaugetypename;
float scale, endscale, endvalue, offset, friction;
std::string submodelname;
std::string gaugetypename;
float scale;
float endscale;
float endvalue;
float offset;
float friction;
endscale = -1;
endvalue = -1;
bool interpolatescale { false };
@@ -144,7 +149,7 @@ void TGauge::Load( cParser &Parser, TDynamicObject const *Owner, double const mu
{
scratch_data scratchpad;
while( true == Load_mapping( Parser, scratchpad ) ) {
; // all work done by while()
// all work done by while()
}
// post-deserialization cleanup
// set provided custom soundproofing to assigned sounds (for sounds without their own custom soundproofing)

View File

@@ -67,8 +67,8 @@ public:
bool is_delayed() const {
return ( static_cast<int>( type() ) & static_cast<int>( TGaugeType::delayed ) ) != 0; }
// members
TSubModel *SubModel { nullptr }, // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
*SubModelOn { nullptr }; // optional submodel visible when the state input is set
TSubModel *SubModel { nullptr }; // McZapkie-310302: zeby mozna bylo sprawdzac czy zainicjowany poprawnie
TSubModel *SubModelOn { nullptr }; // optional submodel visible when the state input is set
private:
// types

View File

@@ -87,7 +87,7 @@ void TTrain::screen_entry::deserialize(cParser &Input)
while (true == deserialize_mapping(Input))
{
; // all work done by while()
// all work done by while()
}
}
@@ -1703,12 +1703,10 @@ void TTrain::OnCommand_secondcontrollerset(TTrain *Train, command_data const &Co
while (targetposition < Train->mvControlled->GetVirtualScndPos() && true == Train->mvControlled->DecScndCtrl(1))
{
// all work is done in the header
;
}
while (targetposition > Train->mvControlled->GetVirtualScndPos() && true == Train->mvControlled->IncScndCtrl(1))
{
// all work is done in the header
;
}
}
}
@@ -2363,7 +2361,7 @@ void TTrain::OnCommand_epbrakecontrolenable(TTrain *Train, command_data const &C
Train->dsbPneumaticSwitch->play();
}
Train->ggEPFuseButton.UpdateValue(1.0f, Train->dsbSwitch);
};
}
}
}
}
@@ -2379,7 +2377,7 @@ void TTrain::OnCommand_epbrakecontroldisable(TTrain *Train, command_data const &
if (Train->mvOccupied->EpFuseSwitch(false))
{
Train->ggEPFuseButton.UpdateValue(0.0f, Train->dsbSwitch);
};
}
}
}
}
@@ -2410,7 +2408,7 @@ void TTrain::OnCommand_epbrakecontroltoggle(TTrain *Train, command_data const &C
{
Train->dsbPneumaticSwitch->play();
}
};
}
}
else
{
@@ -2428,7 +2426,7 @@ void TTrain::OnCommand_epbrakecontroltoggle(TTrain *Train, command_data const &C
{
Train->dsbPneumaticSwitch->play();
}
};
}
}
// visual feedback
Train->ggEPFuseButton.UpdateValue(ispush ? 1.0f : // push or pushtoggle
@@ -2705,7 +2703,6 @@ void TTrain::OnCommand_reverserdecrease(TTrain *Train, command_data const &Comma
{
Train->DynamicObject->Mechanik->DirectionChange();
;
}
}
}
@@ -12147,7 +12144,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
else if (Label == "eimscreen:")
{
// amperomierz calkowitego pradu
int i, j;
int i;
int j;
Parser.getTokens(2, false);
Parser >> i >> j;
auto &gauge = Cabine[Cabindex].Gauge(-1); // pierwsza wolna gałka
@@ -12157,7 +12155,8 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
else if (Label == "brakes:")
{
// specified pipe pressure of specified consist vehicle
int i, j;
int i;
int j;
Parser.getTokens(2, false);
Parser >> i >> j;
auto &gauge = Cabine[Cabindex].Gauge(-1); // pierwsza wolna gałka

View File

@@ -817,31 +817,31 @@ public: // reszta może by?publiczna
TButton btHaslerBrakes; // ciśnienie w cylindrach
TButton btHaslerCurrent; // prąd na silnikach
std::optional<sound_source>
dsbNastawnikJazdy,
dsbNastawnikBocz,
dsbReverserKey,
dsbBuzzer, dsbBuzzerShp,
m_radiostop,
dsbSlipAlarm,
m_distancecounterclear,
dsbHasler,
dsbSwitch,
dsbPneumaticSwitch,
rsHiss,
rsHissU,
rsHissE,
rsHissX,
rsHissT,
rsSBHiss,
rsSBHissU,
rsBrake,
rsFadeSound,
rsRunningNoise,
rsResonanceNoise,
rsWindSound,
rsHuntingNoise,
m_rainsound;
std::optional<sound_source> dsbNastawnikJazdy;
std::optional<sound_source> dsbNastawnikBocz;
std::optional<sound_source> dsbReverserKey;
std::optional<sound_source> dsbBuzzer;
std::optional<sound_source> dsbBuzzerShp;
std::optional<sound_source> m_radiostop;
std::optional<sound_source> dsbSlipAlarm;
std::optional<sound_source> m_distancecounterclear;
std::optional<sound_source> dsbHasler;
std::optional<sound_source> dsbSwitch;
std::optional<sound_source> dsbPneumaticSwitch;
std::optional<sound_source> rsHiss;
std::optional<sound_source> rsHissU;
std::optional<sound_source> rsHissE;
std::optional<sound_source> rsHissX;
std::optional<sound_source> rsHissT;
std::optional<sound_source> rsSBHiss;
std::optional<sound_source> rsSBHissU;
std::optional<sound_source> rsBrake;
std::optional<sound_source> rsFadeSound;
std::optional<sound_source> rsRunningNoise;
std::optional<sound_source> rsResonanceNoise;
std::optional<sound_source> rsWindSound;
std::optional<sound_source> rsHuntingNoise;
std::optional<sound_source> m_rainsound;
sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages
std::vector<std::pair<int, std::shared_ptr<sound_source>>> m_radiomessages; // list of currently played radio messages
std::vector<std::pair<std::reference_wrapper<std::optional<sound_source>>, glm::vec3>> CabSoundLocations; // list of offsets for manually located sounds;
@@ -879,7 +879,9 @@ private:
float fHVoltage{ 0.0f }; // napi?cie dla dynamicznych ga?ek
float fHCurrent[ 4 ] = { 0.0f, 0.0f, 0.0f, 0.0f }; // pr?dy: suma i amperomierze 1,2,3
float fEngine[ 4 ] = { 0.0f, 0.0f, 0.0f, 0.0f }; // obroty te? trzeba pobra?
int iCarNo, iPowerNo, iUnitNo; // liczba pojazdow, czlonow napednych i jednostek spiętych ze sobą
int iCarNo;
int iPowerNo;
int iUnitNo; // liczba pojazdow, czlonow napednych i jednostek spiętych ze sobą
bool bDoors[20][5]; // drzwi dla wszystkich czlonow; left+right, left, right, step_left, step_right
int iUnits[20]; // numer jednostki
int iDoorNo[20]; // liczba drzwi
@@ -896,7 +898,8 @@ private:
std::vector<std::tuple<bool, bool, int>> bCompressors;
bool bHeat[8]; // grzanie
// McZapkie: do syczenia
float fPPress, fNPress;
float fPPress;
float fNPress;
bool m_mastercontrollerinuse { false };
float m_mastercontrollerreturndelay { 0.f };
screenentry_sequence m_screens;