@@ -1163,20 +1163,11 @@ public void CheckSignalObjects()
11631163 {
11641164 if ( ! thisInfo . processed )
11651165 {
1166- bool process_req = true ;
1167-
1168- if ( ControlMode == TRAIN_CONTROL . AUTO_NODE &&
1169- thisInfo . distance_to_train > DistanceToEndNodeAuthorityM [ 0 ] )
1170- {
1171- process_req = false ;
1172- }
1173- else
1174- {
1175- process_req = thisInfo . distance_to_train > signalApproachDistanceM ||
1166+ var process_req = ( ControlMode != TRAIN_CONTROL . AUTO_NODE ||
1167+ thisInfo . distance_to_train <= DistanceToEndNodeAuthorityM [ 0 ] )
1168+ && ( thisInfo . distance_to_train > signalApproachDistanceM ||
11761169 ( MovementState == AI_MOVEMENT_STATE . RUNNING && SpeedMpS > setSpeed ) ||
1177- MovementState == AI_MOVEMENT_STATE . ACCELERATING ;
1178- }
1179-
1170+ MovementState == AI_MOVEMENT_STATE . ACCELERATING ) ;
11801171 if ( process_req )
11811172 {
11821173 if ( thisInfo . ObjectType == ObjectItemInfo . ObjectItemType . Speedlimit )
@@ -1725,7 +1716,7 @@ public virtual AITrain.AI_MOVEMENT_STATE UpdateStoppedState(float elapsedClockSe
17251716 else if ( nextAspect == MstsSignalAspect . STOP )
17261717 {
17271718 // If stop but train is well away from signal allow to close; also if at end of path.
1728- if ( DistanceToSignal . HasValue && DistanceToSignal . Value > 5 * signalApproachDistanceM ||
1719+ if ( ( DistanceToSignal . HasValue && DistanceToSignal . Value > 5 * signalApproachDistanceM ) ||
17291720 ( TCRoute . TCRouteSubpaths [ TCRoute . activeSubpath ] . Count - 1 == PresentPosition [ 0 ] . RouteListIndex ) )
17301721 {
17311722 MovementState = AI_MOVEMENT_STATE . ACCELERATING ;
@@ -3052,11 +3043,11 @@ public virtual void UpdateFollowingState(float elapsedClockSeconds, int presentT
30523043 {
30533044 var rearOrFront = ValidRoute [ 0 ] [ ValidRoute [ 0 ] . Count - 1 ] . Direction == 1 ? 0 : 1 ;
30543045
3055- if ( OtherTrain . TrainType == TRAINTYPE . STATIC || ( OtherTrain . PresentPosition [ 0 ] . TCSectionIndex ==
3046+ if ( OtherTrain . TrainType == TRAINTYPE . STATIC || ( ( OtherTrain . PresentPosition [ 0 ] . TCSectionIndex ==
30563047 TCRoute . TCRouteSubpaths [ TCRoute . activeSubpath ] [ TCRoute . TCRouteSubpaths [ TCRoute . activeSubpath ] . Count - 1 ] . TCSectionIndex
30573048 || OtherTrain . PresentPosition [ 1 ] . TCSectionIndex ==
30583049 TCRoute . TCRouteSubpaths [ TCRoute . activeSubpath ] [ TCRoute . TCRouteSubpaths [ TCRoute . activeSubpath ] . Count - 1 ] . TCSectionIndex ) &&
3059- ( TCRoute . ReversalInfo [ TCRoute . activeSubpath ] . Valid || TCRoute . activeSubpath == TCRoute . TCRouteSubpaths . Count - 1 )
3050+ ( TCRoute . ReversalInfo [ TCRoute . activeSubpath ] . Valid || TCRoute . activeSubpath == TCRoute . TCRouteSubpaths . Count - 1 ) )
30603051 || UncondAttach )
30613052 {
30623053 attachToTrain = true ;
@@ -6257,17 +6248,15 @@ public bool SwitchToAutopilotControl()
62576248 StationStops [ 0 ] . ActualArrival = - ( int ) ( new DateTime ( ) . Add ( TimeSpan . FromSeconds ( 0.0 ) ) - ( ( ActivityTaskPassengerStopAt ) Simulator . ActivityRun . Current ) . ActArrive ) . Value . TotalSeconds ;
62586249 MovementState = AI_MOVEMENT_STATE . STATION_STOP ;
62596250 }
6260- else if ( this != Simulator . OriginalPlayerTrain && AtStation )
6261- {
6262- MovementState = AI_MOVEMENT_STATE . STATION_STOP ;
6263- }
62646251 else
62656252 {
6266- MovementState = Math . Abs ( SpeedMpS ) <= 0.1f && ( ( AuxActionsContain . SpecAuxActions . Count > 0 && AuxActionsContain . SpecAuxActions [ 0 ] is AIActionWPRef && ( AuxActionsContain . SpecAuxActions [ 0 ] as AIActionWPRef ) . keepIt != null &&
6267- ( AuxActionsContain . SpecAuxActions [ 0 ] as AIActionWPRef ) . keepIt . currentMvmtState == AITrain . AI_MOVEMENT_STATE . HANDLE_ACTION ) || ( nextActionInfo is AuxActionWPItem &&
6268- MovementState == AITrain . AI_MOVEMENT_STATE . HANDLE_ACTION ) )
6269- ? AI_MOVEMENT_STATE . HANDLE_ACTION
6270- : AI_MOVEMENT_STATE . STOPPED ;
6253+ MovementState = this != Simulator . OriginalPlayerTrain && AtStation
6254+ ? AI_MOVEMENT_STATE . STATION_STOP
6255+ : Math . Abs ( SpeedMpS ) <= 0.1f && ( ( AuxActionsContain . SpecAuxActions . Count > 0 && AuxActionsContain . SpecAuxActions [ 0 ] is AIActionWPRef && ( AuxActionsContain . SpecAuxActions [ 0 ] as AIActionWPRef ) . keepIt != null &&
6256+ ( AuxActionsContain . SpecAuxActions [ 0 ] as AIActionWPRef ) . keepIt . currentMvmtState == AITrain . AI_MOVEMENT_STATE . HANDLE_ACTION ) || ( nextActionInfo is AuxActionWPItem &&
6257+ MovementState == AITrain . AI_MOVEMENT_STATE . HANDLE_ACTION ) )
6258+ ? AI_MOVEMENT_STATE . HANDLE_ACTION
6259+ : AI_MOVEMENT_STATE . STOPPED ;
62716260 }
62726261 success = true ;
62736262 return success ;
@@ -6433,14 +6422,7 @@ public override void CheckStationTask()
64336422 }
64346423
64356424 // Set display text color
6436- if ( remaining < 1 )
6437- {
6438- DisplayColor = Color . LightGreen ;
6439- }
6440- else
6441- {
6442- DisplayColor = remaining < 11 ? new Color ( 255 , 255 , 128 ) : Color . White ;
6443- }
6425+ DisplayColor = remaining < 1 ? Color . LightGreen : remaining < 11 ? new Color ( 255 , 255 , 128 ) : Color . White ;
64446426
64456427 // Clear holding signal
64466428 if ( remaining < ( IsActualPlayerTrain ? 120 : 2 ) && remaining > 0 && StationStops [ 0 ] . ExitSignal >= 0 ) // Within two minutes of departure and hold signal?
@@ -6645,10 +6627,9 @@ public static AILevelCrossingHornPattern CreateInstance(LevelCrossingHornPattern
66456627 /// <param name="outf"></param>
66466628 public void Save ( BinaryWriter outf )
66476629 {
6648- LevelCrossingHornPattern type ;
6649- if ( this is AILevelCrossingSingleHorn )
6650- type = LevelCrossingHornPattern . Single ;
6651- else type = this is AILevelCrossingAmericanHorn ? LevelCrossingHornPattern . US : throw new ArgumentException ( ) ;
6630+ var type = this is AILevelCrossingSingleHorn
6631+ ? LevelCrossingHornPattern . Single
6632+ : this is AILevelCrossingAmericanHorn ? LevelCrossingHornPattern . US : throw new ArgumentException ( ) ;
66526633 outf . Write ( ( int ) type ) ;
66536634 }
66546635
0 commit comments