mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-09 13:42:26 +01:00
whois: add lookahead mode for the timetable entry after the next stop
Dispatcher scripts that route trains at a station based on where they go afterwards (e.g. a big terminal throat with several outbound directions) have no way to read that: whois +40 only exposes the current/next timetable entry (NextStop()/IsStop()), which while the train is at that very station is that station itself. Adds flags::whois_ahead (bit 6, previously unused) plus TTrainParameters::StationNameAhead(Offset)/StationIsStopAhead(Offset), returning the raw TimeTable[] entry Offset positions past StationIndex (name and whether it's a booked stop, "none"/false past the end of the timetable). The new whois branch calls both with Offset=1, mirroring the existing +40 branch's UpdateValues()/WriteLog() shape. Logic-verified with an isolated harness mirroring the touched types (TTrainParameters/TController/TMemCell shapes and the exact function bodies); not yet build-tested against the full engine locally - relying on CI for that.
This commit is contained in:
@@ -77,6 +77,22 @@ bool TTrainParameters::IsLastStop() const {
|
||||
return StationIndex >= StationCount;
|
||||
}
|
||||
|
||||
std::string TTrainParameters::StationNameAhead( int Offset ) const
|
||||
{ // nazwa wpisu rozkladu Offset pozycji za aktualnym (bez pomijania przelotow)
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
bool TTrainParameters::IsMaintenance() const {
|
||||
if( StationIndex <= StationCount )
|
||||
|
||||
Reference in New Issue
Block a user