18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-28 13:46:22 +01:00

feat: timetable service flags for the AI driver (eu07/maszyna#95)

A timetable can now tell the AI how the train is served, for trams,
underground trains and the like. The whole train gets them from a new
row of the first box of the header:

  [ Flagi AI | drzwi_centralne=tak,stopien=nie,kierownik=nie,proba_hamulca=nie ]

and a station changes them from there on with entries of its station
ware (the second line of the station, next to R2, ph, @):

  [       |     | po,kierownik=nie                 1  12.54  |        ]

- drzwi_centralne=tak: the driver opens all the doors from the cab,
  those of mixed control too (otherwise left to the passengers)
- stopien=tak/nie: the doorsteps switched on/off before the doors open
  (the AI didn't touch them before; new driver hints for it)
- kierownik=nie: no conductor, so no departure signal (direct or by
  radio) and no first door kept open for him before the departure
- proba_hamulca=nie: no running brake test

A flag left out keeps today's behaviour, so a timetable without flags
drives as before. Old builds skip the header row and keep the station
entries as station ware text (none starts with R or holds @, po, pt).

The reader moves out of TTrainParameters::LoadTTfile into
world/timetablereader.cpp (eu07_core) unchanged, so the tests can run it;
the flags come out of the station ware there. It now ends at the end of
the file with an error where the old one spun forever (a truncated file,
a missing number), and stops at 100 stations instead of writing past
the table.

Every .txt of the game's sceneries and of the SVN data reads the same
as with the old reader (compared field by field against a verbatim copy
of it); EU07_UNIT_TESTS_TIMETABLES=<scenery folder> reads them in the
unit tests and EU07_UNIT_TESTS_TIMETABLES_DUMP writes what was read.
This commit is contained in:
jerrrrycho
2026-11-17 00:17:22 +01:00
parent 0371581049
commit aa84e41f09
14 changed files with 1038 additions and 305 deletions

View File

@@ -1150,6 +1150,29 @@ TController::cue_action( driver_hint const Action, float const Actionparameter )
return IsAnyDoorPermitActive[side::left] == false; } );
break;
}
// doorsteps, as the timetable asks (eu07/maszyna#95)
case driver_hint::doorstepon: {
if( AIControllFlag ) {
mvOccupied->PermitDoorStep( true );
}
remove_hint( driver_hint::doorstepoff );
hint(
Action,
[this](float const /*Parameter*/) {
return mvOccupied->Doors.step_enabled == true; } );
break;
}
case driver_hint::doorstepoff: {
if( AIControllFlag ) {
mvOccupied->PermitDoorStep( false );
}
remove_hint( driver_hint::doorstepon );
hint(
Action,
[this](float const /*Parameter*/) {
return mvOccupied->Doors.step_enabled == false; } );
break;
}
// consist lights
case driver_hint::consistlightson: {
if( AIControllFlag ) {