mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 01:59:19 +02:00
Added optional train category to the timetable
This commit is contained in:
committed by
tmj-fstate
parent
b0342c7447
commit
8dd1ca19d4
37
mtable.cpp
37
mtable.cpp
@@ -310,14 +310,38 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
|
||||
// pliku}
|
||||
// ConversionError:=-7 {błąd niezgodności}
|
||||
TrainName = s; // nadanie nazwy z pliku TXT (bez ścieżki do pliku)
|
||||
bool isCategory = false;
|
||||
while (fin >> s || fin.bad())
|
||||
{
|
||||
if (s.find("_______|") != std::string::npos)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (s == "Kategoria")
|
||||
{
|
||||
isCategory = true;
|
||||
break;
|
||||
}
|
||||
} // while (!(s == "Seria"));
|
||||
if (isCategory)
|
||||
{
|
||||
do
|
||||
{
|
||||
fin >> s;
|
||||
} while (!((s == "|") || (fin.bad())));
|
||||
fin >> TrainCategory;
|
||||
}
|
||||
// else
|
||||
{ /*czytaj naglowek*/
|
||||
while (fin >> s || !fin.bad())
|
||||
{
|
||||
if (s.find("_______|") != std::string::npos)
|
||||
break;
|
||||
// fin >> s;
|
||||
} // while (!(s.find("_______|") != std::string::npos) || fin.eof());
|
||||
if (isCategory)
|
||||
{
|
||||
while (fin >> s || !fin.bad())
|
||||
{
|
||||
if (s.find("_______|") != std::string::npos)
|
||||
break;
|
||||
// fin >> s;
|
||||
} // while (!(s.find("_______|") != std::string::npos) || fin.eof());
|
||||
}
|
||||
while (fin >> s || !fin.bad())
|
||||
{
|
||||
if (s == "[")
|
||||
@@ -622,6 +646,7 @@ bool TTrainParameters::DirectionChange()
|
||||
void TTrainParameters::serialize( dictionary_source *Output ) const {
|
||||
|
||||
Output->insert( "trainnumber", TrainName );
|
||||
Output->insert( "traincategory", TrainCategory );
|
||||
Output->insert( "train_brakingmassratio", BrakeRatio );
|
||||
Output->insert( "train_enginetype", LocSeries );
|
||||
Output->insert( "train_engineload", LocLoad );
|
||||
|
||||
Reference in New Issue
Block a user