File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Source/Orts.Simulation/Simulation/Signalling Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -368,6 +368,30 @@ public void RestoreTrains(List<Train> trains)
368368 {
369369 enabledTrain = thisSection . CircuitState . TrainReserved ;
370370 }
371+ else if ( thisSection . CircuitState . HasTrainsOccupying ( ) )
372+ {
373+ List < Train . TrainRouted > trainList = thisSection . CircuitState . TrainsOccupying ( ) ;
374+ float ? offsetInSection = null ;
375+
376+ foreach ( var thisRouted in trainList )
377+ {
378+ var thisTrain = thisRouted . Train ;
379+ var thisOffset = thisTrain . PresentPosition [ 0 ] . TCOffset ;
380+ if ( ! offsetInSection . HasValue || thisOffset > offsetInSection )
381+ {
382+ offsetInSection = thisOffset ;
383+ if ( thisTrain . Number == number )
384+ {
385+ enabledTrain = thisRouted ;
386+ thisTrain . NextSignalObject [ 0 ] = this ;
387+ }
388+ else
389+ {
390+ enabledTrain = null ;
391+ }
392+ }
393+ }
394+ }
371395 else
372396 {
373397 enabledTrain = null ; // reset - train not found
You can’t perform that action at this time.
0 commit comments