mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-09 13:42:26 +01:00
whois: consolidate the two lookahead accessors into one
Per review: StationNameAhead()/StationIsStopAhead() duplicated the same bounds check for no reason. Replaced with a single TimeTableEntryAhead(Offset) returning the TMTableLine itself; the whois branch reads .StationName/.Ah off it directly.
This commit is contained in:
@@ -77,20 +77,13 @@ bool TTrainParameters::IsLastStop() const {
|
||||
return StationIndex >= StationCount;
|
||||
}
|
||||
|
||||
std::string TTrainParameters::StationNameAhead( int Offset ) const
|
||||
{ // nazwa wpisu rozkladu Offset pozycji za aktualnym (bez pomijania przelotow)
|
||||
TMTableLine const &TTrainParameters::TimeTableEntryAhead( int Offset ) const
|
||||
{ // wpis rozkladu Offset pozycji za aktualnym (bez pomijania przelotow);
|
||||
// poza zakresem 1..StationCount zwraca techniczny wpis zerowy
|
||||
int const idx { StationIndex + Offset };
|
||||
if( ( idx < 1 ) || ( idx > StationCount ) )
|
||||
return "none";
|
||||
return TimeTable[idx].StationName;
|
||||
}
|
||||
|
||||
bool TTrainParameters::StationIsStopAhead( int Offset ) const
|
||||
{ // czy wpis Offset pozycji za aktualnym to zaplanowany postoj
|
||||
int const idx { StationIndex + Offset };
|
||||
if( ( idx < 1 ) || ( idx > StationCount ) )
|
||||
return false;
|
||||
return TimeTable[idx].Ah >= 0; //-1 to brak postoju
|
||||
return TimeTable[0];
|
||||
return TimeTable[idx];
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user