@@ -92,6 +92,7 @@ public class TrainCarOperationsViewerWindow : Window
92
92
public int WindowHeightMax ;
93
93
public int WindowWidthMin ;
94
94
public int WindowWidthMax ;
95
+ public bool CabCameraEnabled ;
95
96
public int windowHeight { get ; set ; } //required by TrainCarWindow
96
97
public int CarPosition
97
98
{
@@ -172,6 +173,8 @@ protected internal override void Restore(BinaryReader inf)
172
173
CarPosition = inf . ReadInt32 ( ) ;
173
174
ResetAllSymbols = inf . ReadBoolean ( ) ;
174
175
176
+ CabCameraEnabled = Owner . Viewer . Camera is CabCamera || Owner . Viewer . Camera == Owner . Viewer . ThreeDimCabCamera ;
177
+
175
178
// Display window
176
179
SizeTo ( LocationRestore . Width , LocationRestore . Height ) ;
177
180
MoveTo ( LocationRestore . X , LocationRestore . Y ) ;
@@ -472,10 +475,18 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
472
475
{
473
476
// Updates CarPosition
474
477
CarPosition = CouplerChanged ? NewCarPosition : CarPosition ;
475
-
476
- if ( OldCarPosition != CarPosition || ( trainCarOperations . CarIdClicked && CarPosition == 0 ) )
478
+
479
+ if ( CabCameraEnabled ) // Displays camera 1
477
480
{
478
- Owner . Viewer . FrontCamera . Activate ( ) ;
481
+ CabCameraEnabled = false ;
482
+ }
483
+ else if ( OldCarPosition != CarPosition || ( trainCarOperations . CarIdClicked && CarPosition == 0 ) )
484
+ {
485
+ if ( Owner . Viewer . FrontCamera . AttachedCar != null && Owner . Viewer . FrontCamera . IsCameraFront )
486
+ Owner . Viewer . FrontCamera . Activate ( ) ;
487
+
488
+ if ( Owner . Viewer . BackCamera . AttachedCar != null && ! Owner . Viewer . FrontCamera . IsCameraFront )
489
+ Owner . Viewer . BackCamera . Activate ( ) ;
479
490
}
480
491
OldCarPosition = CarPosition ;
481
492
Layout ( ) ;
@@ -498,7 +509,7 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
498
509
499
510
for ( var position = 0 ; position < Owner . Viewer . PlayerTrain . Cars . Count ; position ++ )
500
511
{
501
- if ( trainCarOperations . WarningCarPosition [ position ] )
512
+ if ( trainCarOperations . WarningCarPosition . Count > position && trainCarOperations . WarningCarPosition [ position ] )
502
513
{
503
514
var carAngleCockAOpenAmount = Owner . Viewer . PlayerTrain . Cars [ position ] . BrakeSystem . AngleCockAOpenAmount ;
504
515
var carAngleCockBOpenAmount = Owner . Viewer . PlayerTrain . Cars [ position ] . BrakeSystem . AngleCockBOpenAmount ;
0 commit comments