File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2268,9 +2268,9 @@ public override void Redo()
22682268 {
22692269 if ( Receiver ? . Train != null )
22702270 {
2271+ var wagonFilePath = PickedEOTType . ToLower ( ) ;
22712272 if ( ToState )
22722273 {
2273- var wagonFilePath = PickedEOTType . ToLower ( ) ;
22742274 try
22752275 {
22762276 EOT eot = ( EOT ) RollingStock . Load ( Receiver . Train . Simulator , Receiver . Train , wagonFilePath ) ;
@@ -2287,8 +2287,14 @@ public override void Redo()
22872287 }
22882288 else
22892289 {
2290- Receiver . Train . RecalculateRearTDBTraveller ( ) ;
22912290 var car = Receiver . Train . Cars [ Receiver . Train . Cars . Count - 1 ] ;
2291+ if ( wagonFilePath != car . WagFilePath . ToLower ( ) )
2292+ {
2293+ car = Receiver . Train . Cars [ 0 ] ;
2294+ if ( Receiver . Train . LeadLocomotive != null ) Receiver . Train . LeadLocomotiveIndex -- ;
2295+ }
2296+ else
2297+ Receiver . Train . RecalculateRearTDBTraveller ( ) ;
22922298 car . Train = null ;
22932299 car . IsPartOfActiveTrain = false ; // to stop sounds
22942300 Receiver . Train . Cars . Remove ( car ) ;
Original file line number Diff line number Diff line change @@ -103,7 +103,8 @@ void EOTListLabel_Click(Control arg1, Point arg2)
103103 Viewer . Simulator . Confirmer . Information ( Viewer . Catalog . GetString ( "Can't attach EOT if player train not stopped" ) ) ;
104104 return ;
105105 }
106- if ( PickedEOTTypeFromList . ToLower ( ) != Viewer . PlayerLocomotive . Train . Cars [ Viewer . PlayerLocomotive . Train . Cars . Count - 1 ] . WagFilePath . ToLower ( ) )
106+ if ( PickedEOTTypeFromList . ToLower ( ) != Viewer . PlayerLocomotive . Train . Cars [ Viewer . PlayerLocomotive . Train . Cars . Count - 1 ] . WagFilePath . ToLower ( ) &&
107+ PickedEOTTypeFromList . ToLower ( ) != Viewer . PlayerLocomotive . Train . Cars [ 0 ] . WagFilePath . ToLower ( ) )
107108 {
108109 if ( Viewer . PlayerLocomotive . Train ? . EOT != null )
109110 {
@@ -113,7 +114,8 @@ void EOTListLabel_Click(Control arg1, Point arg2)
113114 //Ask to mount EOT
114115 new EOTMountCommand ( Viewer . Log , true , PickedEOTTypeFromList ) ;
115116 }
116- else if ( PickedEOTTypeFromList . ToLower ( ) == Viewer . PlayerLocomotive . Train . Cars [ Viewer . PlayerLocomotive . Train . Cars . Count - 1 ] . WagFilePath . ToLower ( ) )
117+ else if ( PickedEOTTypeFromList . ToLower ( ) == Viewer . PlayerLocomotive . Train . Cars [ Viewer . PlayerLocomotive . Train . Cars . Count - 1 ] . WagFilePath . ToLower ( ) ||
118+ PickedEOTTypeFromList . ToLower ( ) == Viewer . PlayerLocomotive . Train . Cars [ 0 ] . WagFilePath . ToLower ( ) )
117119 {
118120 new EOTMountCommand ( Viewer . Log , false , PickedEOTTypeFromList ) ;
119121 }
You can’t perform that action at this time.
0 commit comments