16
0
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:
Królik Uszasty
2020-12-21 12:20:26 +01:00
committed by tmj-fstate
parent b0342c7447
commit 8dd1ca19d4
2 changed files with 32 additions and 6 deletions

View File

@@ -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 );

View File

@@ -50,6 +50,7 @@ class TTrainParameters
{
public:
std::string TrainName;
std::string TrainCategory;
double TTVmax;
std::string Relation1;
std::string Relation2; // nazwy stacji danego odcinka