@@ -1828,42 +1828,47 @@ public override void Update(float elapsedClockSeconds)
1828
1828
var gearloco = this as MSTSDieselLocomotive ;
1829
1829
1830
1830
// Pass Gearbox commands
1831
+
1832
+
1833
+
1834
+
1831
1835
// Note - at the moment there is only one GearBox Controller created, but a gearbox for each diesel engine is created.
1832
1836
// This code keeps all gearboxes in the locomotive aligned with the first engine and gearbox.
1833
- if ( gearloco != null && gearloco . DieselTransmissionType == MSTSDieselLocomotive . DieselTransmissionTypes . Mechanic && GearBoxController . CurrentNotch != previousChangedGearBoxNotch && IsLeadLocomotive ( ) )
1837
+ if ( gearloco != null && gearloco . DieselTransmissionType == MSTSDieselLocomotive . DieselTransmissionTypes . Mechanic && GearBoxController . CurrentNotch != previousChangedGearBoxNotch )
1834
1838
{
1835
- // pass gearbox command key to other gearboxes in the same locomotive, only do the current locomotive
1839
+ // pass gearbox command key to other gearboxes in the same locomotive, only do the current locomotive
1836
1840
1837
- if ( gearloco == this )
1841
+ int ii = 0 ;
1842
+ foreach ( var eng in gearloco . DieselEngines . DEList )
1838
1843
{
1839
-
1840
- int ii = 0 ;
1841
- foreach ( var eng in gearloco . DieselEngines . DEList )
1844
+ // don't change the first engine as this is the reference for all the others
1845
+ if ( ii != 0 )
1842
1846
{
1843
- // don't change the first engine as this is the reference for all the others
1844
- if ( ii != 0 )
1845
- {
1846
- gearloco . DieselEngines [ ii ] . GearBox . currentGearIndex = gearloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
1847
- }
1848
-
1849
- ii = ii + 1 ;
1847
+ gearloco . DieselEngines [ ii ] . GearBox . currentGearIndex = gearloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
1850
1848
}
1849
+
1850
+ ii = ii + 1 ;
1851
1851
}
1852
1852
1853
- // pass gearbox command key to other locomotives in train, don't treat the player locomotive in this fashion.
1853
+ }
1854
+
1855
+ // The lead locomotive passes gearbox commands position to other locomotives in train, don't treat the player locomotive in this fashion.
1856
+
1857
+ if ( gearloco != null && gearloco . DieselTransmissionType == MSTSDieselLocomotive . DieselTransmissionTypes . Mechanic && GearBoxController . CurrentNotch != previousChangedGearBoxNotch && IsLeadLocomotive ( ) )
1858
+ {
1859
+
1854
1860
foreach ( TrainCar car in Train . Cars )
1855
1861
{
1856
- var dieselloco = this as MSTSDieselLocomotive ;
1857
1862
var locog = car as MSTSDieselLocomotive ;
1858
1863
1859
- if ( locog != null && dieselloco != null && car != this && ! locog . IsLeadLocomotive ( ) )
1864
+ if ( locog != null && gearloco != null && car != this && ! locog . IsLeadLocomotive ( ) )
1860
1865
{
1861
1866
1862
- locog . DieselEngines [ 0 ] . GearBox . currentGearIndex = dieselloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
1867
+ locog . DieselEngines [ 0 ] . GearBox . currentGearIndex = gearloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
1863
1868
1864
- locog . GearBoxController . CurrentNotch = dieselloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex + 1 ;
1865
- locog . GearboxGearIndex = dieselloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex + 1 ;
1866
- locog . GearBoxController . SetValue ( ( float ) dieselloco . GearBoxController . CurrentNotch ) ;
1869
+ locog . GearBoxController . CurrentNotch = gearloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex + 1 ;
1870
+ locog . GearboxGearIndex = gearloco . DieselEngines [ 0 ] . GearBox . CurrentGearIndex + 1 ;
1871
+ locog . GearBoxController . SetValue ( ( float ) gearloco . GearBoxController . CurrentNotch ) ;
1867
1872
1868
1873
locog . Simulator . Confirmer . ConfirmWithPerCent ( CabControl . GearBox , CabSetting . Increase , locog . GearBoxController . CurrentNotch ) ;
1869
1874
locog . AlerterReset ( TCSEvent . GearBoxChanged ) ;
0 commit comments