17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 09:49:19 +02:00

refactor(sonar): merge collapsible nested if statements (cpp:S1066)

Comments that preceded the inner if are kept above the merged statement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jerrrrycho
2026-10-10 15:39:11 +02:00
parent 3198cabc78
commit f8104bd0dd
17 changed files with 616 additions and 882 deletions

View File

@@ -565,14 +565,11 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
fin.close();
}
}
if (ConversionError == 0)
{
if (TimeTable[1].StationName == Relation1) // jeśli nazwa pierwszego zgodna z relacją
if (TimeTable[1].Ah < 0) // a nie podany czas przyjazdu
{ // to mamy zatrzymanie na pierwszym, a nie przelot
TimeTable[1].Ah = TimeTable[1].Dh;
TimeTable[1].Am = TimeTable[1].Dm;
}
// jeśli nazwa pierwszego zgodna z relacją
if (ConversionError == 0 && TimeTable[1].StationName == Relation1 && TimeTable[1].Ah < 0) // a nie podany czas przyjazdu
{ // to mamy zatrzymanie na pierwszym, a nie przelot
TimeTable[1].Ah = TimeTable[1].Dh;
TimeTable[1].Am = TimeTable[1].Dm;
}
//
load_sounds();
@@ -632,9 +629,9 @@ TTrainParameters::load_sounds() {
bool TTrainParameters::DirectionChange() const
// sprawdzenie, czy po zatrzymaniu wykonać kolejne komendy
{
if (StationIndex > 0 && StationIndex < StationCount) // dla ostatniej stacji nie
if (contains( TimeTable[StationIndex].StationWare, '@') )
return true;
// dla ostatniej stacji nie
if (StationIndex > 0 && StationIndex < StationCount && contains( TimeTable[StationIndex].StationWare, '@'))
return true;
return false;
}