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 @@ -2265,9 +2265,9 @@ public override void Redo()
22652265 {
22662266 if ( Receiver ? . Train != null )
22672267 {
2268+ var wagonFilePath = PickedEOTType . ToLower ( ) ;
22682269 if ( ToState )
22692270 {
2270- var wagonFilePath = PickedEOTType . ToLower ( ) ;
22712271 try
22722272 {
22732273 EOT eot = ( EOT ) RollingStock . Load ( Receiver . Train . Simulator , Receiver . Train , wagonFilePath ) ;
@@ -2284,8 +2284,14 @@ public override void Redo()
22842284 }
22852285 else
22862286 {
2287- Receiver . Train . RecalculateRearTDBTraveller ( ) ;
22882287 var car = Receiver . Train . Cars [ Receiver . Train . Cars . Count - 1 ] ;
2288+ if ( wagonFilePath != car . WagFilePath . ToLower ( ) )
2289+ {
2290+ car = Receiver . Train . Cars [ 0 ] ;
2291+ if ( Receiver . Train . LeadLocomotive != null ) Receiver . Train . LeadLocomotiveIndex -- ;
2292+ }
2293+ else
2294+ Receiver . Train . RecalculateRearTDBTraveller ( ) ;
22892295 car . Train = null ;
22902296 car . IsPartOfActiveTrain = false ; // to stop sounds
22912297 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