@@ -55,6 +55,7 @@ public class MSTSControlTrailerCar : MSTSLocomotive
55
55
bool ControlGearDown = false ;
56
56
int ControlGearIndex ;
57
57
int ControlGearIndication ;
58
+ string ControlGearBoxType ;
58
59
59
60
60
61
public MSTSControlTrailerCar ( Simulator simulator , string wagFile )
@@ -216,11 +217,15 @@ public override void Update(float elapsedClockSeconds)
216
217
}
217
218
}
218
219
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
220
221
if ( locog != null )
221
222
{
222
223
ControlGearIndex = locog . DieselEngines [ 0 ] . GearBox . CurrentGearIndex ;
223
224
ControlGearIndication = locog . DieselEngines [ 0 ] . GearBox . GearIndication ;
225
+ if ( locog . DieselEngines [ 0 ] . GearBox . GearBoxType == TypesGearBox . C )
226
+ {
227
+ ControlGearBoxType = "C" ;
228
+ }
224
229
}
225
230
}
226
231
@@ -270,25 +275,53 @@ protected override void UpdateSoundVariables(float elapsedClockSeconds)
270
275
public override void ChangeGearUp ( )
271
276
{
272
277
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
+ }
274
302
275
- if ( GearBoxController . CurrentNotch > ControllerNumberOfGears )
276
- {
277
- GearBoxController . CurrentNotch = ControllerNumberOfGears ;
278
- }
279
- else if ( GearBoxController . CurrentNotch < 0 )
280
- {
281
- GearBoxController . CurrentNotch = 0 ;
282
- }
283
-
284
303
ControlGearUp = true ;
285
304
ControlGearDown = false ;
286
305
287
306
}
288
307
289
308
public override void ChangeGearDown ( )
290
309
{
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
+ }
292
325
293
326
if ( GearBoxController . CurrentNotch > ControllerNumberOfGears )
294
327
{
@@ -303,9 +336,5 @@ public override void ChangeGearDown()
303
336
ControlGearDown = true ;
304
337
305
338
}
306
-
307
-
308
-
309
-
310
339
}
311
340
}
0 commit comments