File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -690,13 +690,14 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
690690 // Updates power supply status
691691 else if ( SelectedCarPosition <= CarPositionVisible && SelectedCarPosition == CarPosition )
692692 {
693- var powerSupplyStatusChanged = PowerSupplyStatus != null && PowerSupplyStatus != Owner . Viewer . PlayerTrain . Cars [ CarPosition ] . GetStatus ( ) ;
694- var batteyStatusChanged = BatteryStatus != null && BatteryStatus != Owner . Viewer . PlayerTrain . Cars [ CarPosition ] . GetStatus ( ) ;
695- var circuitBreakerStateChanged = CircuitBreakerState != null && CircuitBreakerState != ( Owner . Viewer . PlayerTrain . Cars [ CarPosition ] as MSTSElectricLocomotive ) . ElectricPowerSupply . CircuitBreaker . State . ToString ( ) ;
693+ var carposition = Owner . Viewer . PlayerTrain . Cars . Count > CarPosition ? CarPosition : CarPosition - 1 ;
694+ var powerSupplyStatusChanged = PowerSupplyStatus != null && PowerSupplyStatus != Owner . Viewer . PlayerTrain . Cars [ carposition ] . GetStatus ( ) ;
695+ var batteyStatusChanged = BatteryStatus != null && BatteryStatus != Owner . Viewer . PlayerTrain . Cars [ carposition ] . GetStatus ( ) ;
696+ var circuitBreakerStateChanged = CircuitBreakerState != null && CircuitBreakerState != ( Owner . Viewer . PlayerTrain . Cars [ carposition ] as MSTSElectricLocomotive ) . ElectricPowerSupply . CircuitBreaker . State . ToString ( ) ;
696697
697698 if ( powerSupplyStatusChanged || batteyStatusChanged || circuitBreakerStateChanged )
698699 {
699- var Status = Owner . Viewer . PlayerTrain . Cars [ CarPosition ] . GetStatus ( ) ;
700+ var Status = Owner . Viewer . PlayerTrain . Cars [ carposition ] . GetStatus ( ) ;
700701 if ( Status != null && Status != PowerSupplyStatus )
701702 {
702703 PowerSupplyStatus = Status ;
You can’t perform that action at this time.
0 commit comments