@@ -427,8 +427,6 @@ public float OdometerM
427
427
public float CombinedControlSplitPosition ;
428
428
public bool HasSmoothStruc ;
429
429
430
- bool controlTrailerBrakeSystemSet = false ;
431
-
432
430
public float MaxContinuousForceN ;
433
431
public float SpeedOfMaxContinuousForceMpS ; // Speed where maximum tractive effort occurs
434
432
public float MSTSSpeedOfMaxContinuousForceMpS ; // Speed where maximum tractive effort occurs - MSTS parameter if used
@@ -2018,32 +2016,6 @@ public void DynamicBrakeBlending(float elapsedClockSeconds)
2018
2016
/// </summary>
2019
2017
public override void Update ( float elapsedClockSeconds )
2020
2018
{
2021
- // A control car typically doesn't have its own compressor and relies on the attached power car. However OR uses the lead locomotive as the reference car for compressor calculations.
2022
- // Hence whilst users are encouraged to leave these parameters out of the ENG file, they need to be setup for OR to work correctly.
2023
- // Some parameters need to be split across the unpowered and powered car for correct timing and volume calculations.
2024
- // This setup loop is only processed the first time that update is run.
2025
- if ( EngineType == EngineTypes . Control && ! controlTrailerBrakeSystemSet )
2026
- {
2027
- FindControlActiveLocomotive ( ) ;
2028
-
2029
- if ( ControlActiveLocomotive != null )
2030
- {
2031
- // Split reservoir volume across the power car and the active locomotive
2032
- MainResVolumeM3 = ControlActiveLocomotive . MainResVolumeM3 / 2 ;
2033
- ControlActiveLocomotive . MainResVolumeM3 = MainResVolumeM3 ;
2034
-
2035
- MaxMainResPressurePSI = ControlActiveLocomotive . MaxMainResPressurePSI ;
2036
- MainResPressurePSI = MaxMainResPressurePSI ;
2037
- ControlActiveLocomotive . MainResPressurePSI = MainResPressurePSI ;
2038
- controlTrailerBrakeSystemSet = true ; // Ensure this loop is only processes the first time update routine run
2039
- MaximumMainReservoirPipePressurePSI = ControlActiveLocomotive . MaximumMainReservoirPipePressurePSI ;
2040
- CompressorRestartPressurePSI = ControlActiveLocomotive . CompressorRestartPressurePSI ;
2041
- MainResChargingRatePSIpS = ControlActiveLocomotive . MainResChargingRatePSIpS ;
2042
- BrakePipeChargingRatePSIorInHgpS = ControlActiveLocomotive . BrakePipeChargingRatePSIorInHgpS ;
2043
- TrainBrakePipeLeakPSIorInHgpS = ControlActiveLocomotive . TrainBrakePipeLeakPSIorInHgpS ;
2044
- }
2045
- }
2046
-
2047
2019
var gearloco = this as MSTSDieselLocomotive ;
2048
2020
2049
2021
// Pass Gearbox commands
@@ -5559,97 +5531,35 @@ public virtual float GetDataOf(CabViewControl cvc)
5559
5531
5560
5532
case CABViewControlTypes . RPM :
5561
5533
{
5562
-
5563
- if ( EngineType == EngineTypes . Control )
5564
- {
5565
- FindControlActiveLocomotive ( ) ;
5566
-
5567
- if ( ControlActiveLocomotive != null )
5568
- {
5569
- var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
5570
- if ( activeloco . DieselEngines [ 0 ] != null )
5571
- data = activeloco . DieselEngines [ 0 ] . RealRPM ;
5572
- }
5573
-
5574
- }
5575
- else
5576
- {
5577
- var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5578
- if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5579
- data = mstsDieselLocomotive . DieselEngines [ 0 ] . RealRPM ;
5580
- }
5534
+ var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5535
+ if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5536
+ data = mstsDieselLocomotive . DieselEngines [ 0 ] . RealRPM ;
5581
5537
break ;
5582
5538
}
5583
5539
5584
5540
case CABViewControlTypes . RPM_2 :
5585
5541
{
5586
-
5587
- FindControlActiveLocomotive ( ) ;
5588
-
5589
- if ( ControlActiveLocomotive != null )
5590
- {
5591
- var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
5592
- var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5593
-
5594
- if ( EngineType == EngineTypes . Control && activeloco . DieselEngines . NumOfActiveEngines > 1 )
5595
- {
5596
-
5597
- if ( activeloco . DieselEngines [ 1 ] != null )
5598
- data = activeloco . DieselEngines [ 1 ] . RealRPM ;
5599
- }
5600
- else if ( EngineType == EngineTypes . Diesel && mstsDieselLocomotive . DieselEngines . NumOfActiveEngines > 1 )
5601
- {
5602
- if ( mstsDieselLocomotive . DieselEngines [ 1 ] != null )
5603
- data = mstsDieselLocomotive . DieselEngines [ 1 ] . RealRPM ;
5604
- }
5542
+ if ( this is MSTSDieselLocomotive mstsDieselLocomotive && mstsDieselLocomotive . DieselEngines . NumOfActiveEngines > 1 )
5543
+ {
5544
+ if ( mstsDieselLocomotive . DieselEngines [ 1 ] != null )
5545
+ data = mstsDieselLocomotive . DieselEngines [ 1 ] . RealRPM ;
5605
5546
}
5606
- break ;
5607
5547
}
5548
+ break ;
5608
5549
5609
5550
case CABViewControlTypes . ORTS_DIESEL_TEMPERATURE :
5610
5551
{
5611
-
5612
- if ( EngineType == EngineTypes . Control )
5613
- {
5614
- FindControlActiveLocomotive ( ) ;
5615
-
5616
- if ( ControlActiveLocomotive != null )
5617
- {
5618
- var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
5619
- if ( activeloco . DieselEngines [ 0 ] != null )
5620
- data = activeloco . DieselEngines [ 0 ] . DieselTemperatureDeg ;
5621
- }
5622
-
5623
- }
5624
- else
5625
- {
5626
- var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5627
- if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5628
- data = mstsDieselLocomotive . DieselEngines [ 0 ] . DieselTemperatureDeg ;
5629
- }
5552
+ var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5553
+ if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5554
+ data = mstsDieselLocomotive . DieselEngines [ 0 ] . DieselTemperatureDeg ;
5630
5555
break ;
5631
5556
}
5632
5557
5633
5558
case CABViewControlTypes . ORTS_OIL_PRESSURE :
5634
5559
{
5635
- if ( EngineType == EngineTypes . Control )
5636
- {
5637
- FindControlActiveLocomotive ( ) ;
5638
-
5639
- if ( ControlActiveLocomotive != null )
5640
- {
5641
- var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
5642
- if ( activeloco . DieselEngines [ 0 ] != null )
5643
- data = activeloco . DieselEngines [ 0 ] . DieselOilPressurePSI ;
5644
- }
5645
-
5646
- }
5647
- else
5648
- {
5649
- var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5650
- if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5651
- data = mstsDieselLocomotive . DieselEngines [ 0 ] . DieselOilPressurePSI ;
5652
- }
5560
+ var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
5561
+ if ( mstsDieselLocomotive . DieselEngines [ 0 ] != null )
5562
+ data = mstsDieselLocomotive . DieselEngines [ 0 ] . DieselOilPressurePSI ;
5653
5563
break ;
5654
5564
}
5655
5565
@@ -5852,30 +5762,10 @@ public virtual float GetDataOf(CabViewControl cvc)
5852
5762
}
5853
5763
case CABViewControlTypes . WHEELSLIP :
5854
5764
{
5855
- if ( EngineType == EngineTypes . Control )
5856
- {
5857
- FindControlActiveLocomotive ( ) ;
5858
-
5859
- if ( ControlActiveLocomotive != null )
5860
- {
5861
- var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
5862
- if ( activeloco . DieselEngines [ 0 ] != null )
5863
- {
5864
- if ( activeloco . AdvancedAdhesionModel && Train . TrainType != Train . TRAINTYPE . AI_PLAYERHOSTING && ! Train . Autopilot )
5865
- data = activeloco . HuDIsWheelSlipWarninq ? 1 : 0 ;
5866
- else
5867
- data = activeloco . HuDIsWheelSlip ? 1 : 0 ;
5868
-
5869
- }
5870
- }
5871
- }
5765
+ if ( AdvancedAdhesionModel && Train . TrainType != Train . TRAINTYPE . AI_PLAYERHOSTING && ! Train . Autopilot )
5766
+ data = HuDIsWheelSlipWarninq ? 1 : 0 ;
5872
5767
else
5873
- {
5874
- if ( AdvancedAdhesionModel && Train . TrainType != Train . TRAINTYPE . AI_PLAYERHOSTING && ! Train . Autopilot )
5875
- data = HuDIsWheelSlipWarninq ? 1 : 0 ;
5876
- else
5877
- data = HuDIsWheelSlip ? 1 : 0 ;
5878
- }
5768
+ data = HuDIsWheelSlip ? 1 : 0 ;
5879
5769
break ;
5880
5770
}
5881
5771
0 commit comments