16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 11:09:19 +02:00

radio channel selection tweak, minor bug fixes

This commit is contained in:
tmj-fstate
2020-07-26 13:49:25 +02:00
parent f80a41d3dd
commit 138b793f5a
12 changed files with 47 additions and 20 deletions

View File

@@ -329,6 +329,7 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
{
fin >> s;
} while (!(s.find("[______________") != std::string::npos || fin.bad()));
auto activeradiochannel{ -1 };
while (!fin.bad() && !EndTable)
{
++StationCount;
@@ -421,13 +422,23 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
auto const stationware { Split( record->StationWare, ',' ) };
for( auto const &entry : stationware ) {
if( entry[ 0 ] == 'R' ) {
auto const entrysplit { split_index( entry ) };
auto const entrysplit { split_string_and_number( entry ) };
if( ( entrysplit.first == "R" )
&& ( entrysplit.second <= 10 ) ) {
record->radio_channel = entrysplit.second;
auto const radiochannel { entrysplit.second };
if( ( record->radio_channel == -1 )
|| ( radiochannel != activeradiochannel ) ) {
// if the station has more than one radiochannel listed,
// it generally means we should switch to the one we weren't using so far
// TODO: reverse this behaviour (keep the channel used so far) once W28 signs are included in the system
record->radio_channel = radiochannel;
}
}
}
}
if( record->radio_channel != -1 ) {
activeradiochannel == record->radio_channel;
}
}
record->TrackNo = atoi(s.c_str());
fin >> s;