mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 03:59:19 +02:00
refactor(sonar): split chained assignments (cpp:S1121)
This commit is contained in:
@@ -489,7 +489,9 @@ TMoverParameters::TMoverParameters(double VelInitial, std::string TypeNameInit,
|
||||
for (int k = 1; k < 9; ++k)
|
||||
compressorrow[k] = 0;
|
||||
CompressorList[0][0] = 0.0;
|
||||
CompressorList[1][0] = CompressorList[2][0] = CompressorList[3][0] = 1.0;
|
||||
CompressorList[1][0] = 1.0;
|
||||
CompressorList[2][0] = 1.0;
|
||||
CompressorList[3][0] = 1.0;
|
||||
|
||||
for (int b = -1; b <= MainBrakeMaxPos; ++b)
|
||||
{
|
||||
@@ -669,8 +671,8 @@ bool TMoverParameters::Dettach(int ConnectNo)
|
||||
if (couplingstate < 0)
|
||||
{
|
||||
// gdy scisniete zderzaki, chyba ze zerwany sprzeg (wirtualnego nie odpinamy z drugiej strony)
|
||||
std::tie(coupler.Connected, coupler.ConnectedNr, coupler.CouplingFlag) = std::tie(othercoupler.Connected, othercoupler.ConnectedNr, othercoupler.CouplingFlag) =
|
||||
std::make_tuple(nullptr, -1, coupling::faux);
|
||||
std::tie(othercoupler.Connected, othercoupler.ConnectedNr, othercoupler.CouplingFlag) = std::make_tuple(nullptr, -1, coupling::faux);
|
||||
std::tie(coupler.Connected, coupler.ConnectedNr, coupler.CouplingFlag) = std::make_tuple(nullptr, -1, coupling::faux);
|
||||
}
|
||||
else if (couplingstate > 0)
|
||||
{ // odłączamy węże i resztę, pozostaje sprzęg fizyczny, który wymaga dociśnięcia (z wirtualnym nic)
|
||||
@@ -8187,8 +8189,16 @@ double TMoverParameters::dizel_MomentumRetarder(double n, double dt)
|
||||
void TMoverParameters::dizel_HeatSet(float const Value)
|
||||
{
|
||||
|
||||
dizel_heat.Te = // TODO: don't include ambient temperature, pull it from environment data instead
|
||||
dizel_heat.Ts = dizel_heat.To = dizel_heat.Tsr = dizel_heat.Twy = dizel_heat.Tsr2 = dizel_heat.Twy2 = dizel_heat.temperatura1 = dizel_heat.temperatura2 = Value;
|
||||
// TODO: don't include ambient temperature, pull it from environment data instead
|
||||
dizel_heat.Te = Value;
|
||||
dizel_heat.Ts = Value;
|
||||
dizel_heat.To = Value;
|
||||
dizel_heat.Tsr = Value;
|
||||
dizel_heat.Twy = Value;
|
||||
dizel_heat.Tsr2 = Value;
|
||||
dizel_heat.Twy2 = Value;
|
||||
dizel_heat.temperatura1 = Value;
|
||||
dizel_heat.temperatura2 = Value;
|
||||
}
|
||||
|
||||
// calculates diesel engine temperature and heat transfers
|
||||
@@ -10929,7 +10939,8 @@ void TMoverParameters::LoadFIZ_Cntrl(std::string const &line)
|
||||
// traction motor fans
|
||||
{
|
||||
auto lookup = starts.find(extract_value("MotorBlowersStart", line));
|
||||
MotorBlowers[end::front].start_type = MotorBlowers[end::rear].start_type = lookup != starts.end() ? lookup->second : start_t::manual;
|
||||
MotorBlowers[end::rear].start_type = lookup != starts.end() ? lookup->second : start_t::manual;
|
||||
MotorBlowers[end::front].start_type = MotorBlowers[end::rear].start_type;
|
||||
}
|
||||
// compartment lights
|
||||
{
|
||||
|
||||
@@ -76,7 +76,11 @@ inline float3 SafeNormalize(const float3 &v)
|
||||
auto const l = v.Length();
|
||||
float3 retVal;
|
||||
if (l == 0)
|
||||
retVal.x = retVal.y = retVal.z = 0;
|
||||
{
|
||||
retVal.x = 0;
|
||||
retVal.y = 0;
|
||||
retVal.z = 0;
|
||||
}
|
||||
else
|
||||
retVal = v / l;
|
||||
return retVal;
|
||||
@@ -104,7 +108,9 @@ class float4
|
||||
float w;
|
||||
float4()
|
||||
{
|
||||
x = y = z = 0.f;
|
||||
x = 0.f;
|
||||
y = 0.f;
|
||||
z = 0.f;
|
||||
w = 1.f;
|
||||
};
|
||||
float4(float a, float b, float c, float d)
|
||||
@@ -236,7 +242,10 @@ public:
|
||||
{
|
||||
for (auto &element : e)
|
||||
element = 0;
|
||||
e[0] = e[5] = e[10] = e[15] = 1.0f;
|
||||
e[0] = 1.0f;
|
||||
e[5] = 1.0f;
|
||||
e[10] = 1.0f;
|
||||
e[15] = 1.0f;
|
||||
}
|
||||
const float *operator[](int i) const
|
||||
{
|
||||
|
||||
@@ -589,7 +589,8 @@ TTrain::TTrain()
|
||||
// McZapkie-240302 - przyda sie do tachometru
|
||||
fTachoVelocity = 0;
|
||||
fTachoCount = 0;
|
||||
fPPress = fNPress = 0;
|
||||
fPPress = 0;
|
||||
fNPress = 0;
|
||||
|
||||
// asMessage="";
|
||||
pMechOffset = glm::dvec3(0, 0, 0);
|
||||
@@ -628,7 +629,8 @@ TTrain::TTrain()
|
||||
{
|
||||
for (auto &press : fPress[i])
|
||||
press = 0.0;
|
||||
bBrakes[i][0] = bBrakes[i][1] = false;
|
||||
bBrakes[i][0] = false;
|
||||
bBrakes[i][1] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8522,7 +8524,12 @@ bool TTrain::Update(double const Deltatime)
|
||||
fHCurrent[3] = static_cast<float>(mvSecond->ShowCurrent(3) * 1.05);
|
||||
}
|
||||
else
|
||||
fHCurrent[0] = fHCurrent[1] = fHCurrent[2] = fHCurrent[3] = 0.0; // gdy nie ma człona
|
||||
{
|
||||
fHCurrent[0] = 0.0; // gdy nie ma człona
|
||||
fHCurrent[1] = 0.0;
|
||||
fHCurrent[2] = 0.0;
|
||||
fHCurrent[3] = 0.0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // normalne pokazywanie
|
||||
@@ -8649,9 +8656,19 @@ bool TTrain::Update(double const Deltatime)
|
||||
}
|
||||
else
|
||||
{
|
||||
fPress[i][0] = fPress[i][1] = fPress[i][2] = fPress[i][3] = fPress[i][4] = fPress[i][5] = 0;
|
||||
bDoors[i][0] = bDoors[i][1] = bDoors[i][2] = bDoors[i][3] = bDoors[i][4] = false;
|
||||
bBrakes[i][0] = bBrakes[i][1] = false;
|
||||
fPress[i][0] = 0;
|
||||
fPress[i][1] = 0;
|
||||
fPress[i][2] = 0;
|
||||
fPress[i][3] = 0;
|
||||
fPress[i][4] = 0;
|
||||
fPress[i][5] = 0;
|
||||
bDoors[i][0] = false;
|
||||
bDoors[i][1] = false;
|
||||
bDoors[i][2] = false;
|
||||
bDoors[i][3] = false;
|
||||
bDoors[i][4] = false;
|
||||
bBrakes[i][0] = false;
|
||||
bBrakes[i][1] = false;
|
||||
bSlip[i] = false;
|
||||
iUnits[i] = 0;
|
||||
cCode[i] = 0; //'0';
|
||||
@@ -10692,7 +10709,8 @@ void TTrain::DynamicSet(TDynamicObject *d)
|
||||
// jeździć dobrze
|
||||
// również hamowanie wykonuje się zaworem w członie, a nie w silnikowym...
|
||||
DynamicObject = d; // jedyne miejsce zmiany
|
||||
mvOccupied = mvControlled = d ? DynamicObject->MoverParameters : nullptr; // albo silnikowy w EZT
|
||||
mvControlled = d ? DynamicObject->MoverParameters : nullptr; // albo silnikowy w EZT
|
||||
mvOccupied = mvControlled;
|
||||
|
||||
if (DynamicObject == nullptr)
|
||||
{
|
||||
|
||||
@@ -463,9 +463,11 @@ void TTraction::PowerSet(TTractionPowerSource *ps)
|
||||
else
|
||||
{ // ustalenie punktu zasilania (nie ma jeszcze połączeń między przęsłami)
|
||||
psPowered = ps; // ustawienie bezpośredniego zasilania dla przęsła
|
||||
psPower[0] = psPower[1] = ps; // a to chyba nie jest dobry pomysł, bo nawet zasilane przęsło
|
||||
psPower[0] = ps; // a to chyba nie jest dobry pomysł, bo nawet zasilane przęsło
|
||||
psPower[1] = ps;
|
||||
// powinno mieć wskazania na inne
|
||||
fResistance[0] = fResistance[1] = 0.0; // a liczy się tylko rezystancja zasilacza
|
||||
fResistance[0] = 0.0; // a liczy się tylko rezystancja zasilacza
|
||||
fResistance[1] = 0.0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user