@@ -55,6 +55,7 @@ public class MSTSControlTrailerCar : MSTSLocomotive
5555 bool ControlGearDown = false ;
5656 int ControlGearIndex ;
5757 int ControlGearIndication ;
58+ string ControlGearBoxType ;
5859
5960
6061 public MSTSControlTrailerCar ( Simulator simulator , string wagFile )
@@ -216,11 +217,15 @@ public override void Update(float elapsedClockSeconds)
216217 }
217218 }
218219
219- // Read values for the HuD, will be based upon the last motorcar
220+ // Read values for the HuD and other requirements , will be based upon the last motorcar
220221 if ( locog != null )
221222 {
222223 ControlGearIndex = locog . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
223224 ControlGearIndication = locog . DieselEngines [ 0 ] . GearBox . GearIndication ;
225+ if ( locog . DieselEngines [ 0 ] . GearBox . GearBoxType == TypesGearBox . C )
226+ {
227+ ControlGearBoxType = "C" ;
228+ }
224229 }
225230 }
226231
@@ -270,25 +275,53 @@ protected override void UpdateSoundVariables(float elapsedClockSeconds)
270275 public override void ChangeGearUp ( )
271276 {
272277
273- GearBoxController . CurrentNotch += 1 ;
278+ if ( ControlGearBoxType == "C" )
279+ {
280+ if ( ThrottlePercent == 0 )
281+ {
282+ GearBoxController . CurrentNotch += 1 ;
283+ }
284+ else
285+ {
286+ Simulator . Confirmer . Message ( ConfirmLevel . Warning , Simulator . Catalog . GetString ( "Throttle must be reduced to Idle before gear change can happen." ) ) ;
287+ }
288+ }
289+ else
290+ {
291+ GearBoxController . CurrentNotch += 1 ;
292+ }
293+
294+ if ( GearBoxController . CurrentNotch > ControllerNumberOfGears )
295+ {
296+ GearBoxController . CurrentNotch = ControllerNumberOfGears ;
297+ }
298+ else if ( GearBoxController . CurrentNotch < 0 )
299+ {
300+ GearBoxController . CurrentNotch = 0 ;
301+ }
274302
275- if ( GearBoxController . CurrentNotch > ControllerNumberOfGears )
276- {
277- GearBoxController . CurrentNotch = ControllerNumberOfGears ;
278- }
279- else if ( GearBoxController . CurrentNotch < 0 )
280- {
281- GearBoxController . CurrentNotch = 0 ;
282- }
283-
284303 ControlGearUp = true ;
285304 ControlGearDown = false ;
286305
287306 }
288307
289308 public override void ChangeGearDown ( )
290309 {
291- GearBoxController . CurrentNotch -= 1 ;
310+ if ( ControlGearBoxType == "C" )
311+ {
312+ if ( ThrottlePercent == 0 )
313+ {
314+ GearBoxController . CurrentNotch -= 1 ;
315+ }
316+ else
317+ {
318+ Simulator . Confirmer . Message ( ConfirmLevel . Warning , Simulator . Catalog . GetString ( "Throttle must be reduced to Idle before gear change can happen." ) ) ;
319+ }
320+ }
321+ else
322+ {
323+ GearBoxController . CurrentNotch -= 1 ;
324+ }
292325
293326 if ( GearBoxController . CurrentNotch > ControllerNumberOfGears )
294327 {
@@ -303,9 +336,5 @@ public override void ChangeGearDown()
303336 ControlGearDown = true ;
304337
305338 }
306-
307-
308-
309-
310339 }
311340}
0 commit comments