Skip to content

Commit 86d58ff

Browse files
committed
Create dynamic-reverse interlocking
1 parent 01409bb commit 86d58ff

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

Source/Orts.Simulation/Simulation/Confirmer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public Confirmer(Simulator simulator, double defaultDurationS)
182182
ConfirmText = new string[][] {
183183
new string [] { GetString("<none>") }
184184
// Power
185-
, new string [] { GetParticularString("NonSteam", "Reverser"), GetString("reverse"), GetString("neutral"), GetString("forward"), null, null, GetString("locked. Close throttle, stop train then re-try.") }
185+
, new string [] { GetParticularString("NonSteam", "Reverser"), GetString("reverse"), GetString("neutral"), GetString("forward"), null, null, GetString("locked. Close throttle, release dynamic brake, stop train then re-try.") }
186186
, new string [] { GetString("Throttle"), null, null, null, GetString("close"), GetString("open"), GetString("locked. Release dynamic brake then re-try.") }
187187
, new string [] { GetString("Wheel-slip"), GetString("over"), null, GetString("occurring. Tractive power greatly reduced."), null, null, GetString("warning") }
188188
// Electric power
@@ -226,7 +226,7 @@ public Confirmer(Simulator simulator, double defaultDurationS)
226226
, new string [] { GetString("Train Brake"), null, null, null, GetString("release"), GetString("apply") }
227227
, new string [] { GetString("Engine Brake"), null, null, null, GetString("release"), GetString("apply") }
228228
, new string [] { GetString("Brakeman Brake"), null, null, null, GetString("release"), GetString("apply") }
229-
, new string [] { GetString("Dynamic Brake"), GetString("off"), null, GetString("setup"), GetString("decrease"), GetString("increase") }
229+
, new string [] { GetString("Dynamic Brake"), GetString("off"), null, GetString("setup"), GetString("decrease"), GetString("increase"), GetString("locked. Move reverser then retry.") }
230230
, new string [] { GetString("Emergency Brake"), GetString("release"), null, GetString("apply") }
231231
, new string [] { GetString("Bail Off"), GetString("disengage"), null, GetString("engage") }
232232
, new string [] { GetString("Brakes"), GetString("initialize"), null, null, null, null, GetString("cannot initialize. Stop train then re-try.") }

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,7 @@ public override void Copy(MSTSWagon copy)
11971197
DynamicBrakeCommandStartTime = locoCopy.DynamicBrakeCommandStartTime;
11981198
DynamicBrakeBlendingOverride = locoCopy.DynamicBrakeBlendingOverride;
11991199
DynamicBrakeBlendingForceMatch = locoCopy.DynamicBrakeBlendingForceMatch;
1200+
DynamicBrakeControllerSetupLock = locoCopy.DynamicBrakeControllerSetupLock;
12001201

12011202
MainPressureUnit = locoCopy.MainPressureUnit;
12021203
BrakeSystemPressureUnits = locoCopy.BrakeSystemPressureUnits;
@@ -4448,6 +4449,11 @@ public override string GetBrakemanBrakeStatus()
44484449
#region DynamicBrakeController
44494450
public void StartDynamicBrakeIncrease(float? target)
44504451
{
4452+
if (Direction == Direction.N)
4453+
{
4454+
Simulator.Confirmer.Warning(CabControl.DynamicBrake, CabSetting.Warn1);
4455+
return;
4456+
}
44514457
AlerterReset(TCSEvent.DynamicBrakeChanged);
44524458
if (CruiseControl != null && CruiseControl.SpeedRegMode == CruiseControl.SpeedRegulatorMode.Auto && (CruiseControl.DynamicBrakeCommandHasPriorityOverCruiseControl ||
44534459
(CruiseControl.DisableCruiseControlOnThrottleAndZeroForce && CruiseControl.SelectedMaxAccelerationPercent == 0)))
@@ -4486,6 +4492,11 @@ public void StopDynamicBrakeIncrease()
44864492

44874493
public void StartDynamicBrakeDecrease(float? target)
44884494
{
4495+
if (Direction == Direction.N)
4496+
{
4497+
Simulator.Confirmer.Warning(CabControl.DynamicBrake, CabSetting.Warn1);
4498+
return;
4499+
}
44894500
AlerterReset(TCSEvent.DynamicBrakeChanged);
44904501
if (!CanUseDynamicBrake())
44914502
return;
@@ -4567,6 +4578,11 @@ public void SetDynamicBrakeValue(float value)
45674578

45684579
public void SetDynamicBrakePercent(float percent)
45694580
{
4581+
if (Direction == Direction.N)
4582+
{
4583+
Simulator.Confirmer.Warning(CabControl.DynamicBrake, CabSetting.Warn1);
4584+
return;
4585+
}
45704586
if (!CanUseDynamicBrake())
45714587
return;
45724588
DynamicBrakeController.SetPercent(percent);
@@ -4575,6 +4591,11 @@ public void SetDynamicBrakePercent(float percent)
45754591

45764592
public void SetDynamicBrakePercentWithSound(float percent)
45774593
{
4594+
if (Direction == Direction.N)
4595+
{
4596+
Simulator.Confirmer.Warning(CabControl.DynamicBrake, CabSetting.Warn1);
4597+
return;
4598+
}
45784599
if (!CanUseDynamicBrake())
45794600
return;
45804601
var oldDynamicBrakePercent = DynamicBrakeController.CurrentValue * 100;

Source/RunActivity/Viewer3D/RollingStock/MSTSLocomotiveViewer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected virtual void ReverserControlForwards()
117117
{
118118
if (Locomotive.Direction != Direction.Forward
119119
&& (Locomotive.ThrottlePercent >= 1
120-
|| Math.Abs(Locomotive.SpeedMpS) > 1))
120+
|| Math.Abs(Locomotive.SpeedMpS) > 1 || Locomotive.DynamicBrakeIntervention >= 0))
121121
{
122122
Viewer.Simulator.Confirmer.Warning(CabControl.Reverser, CabSetting.Warn1);
123123
return;
@@ -129,7 +129,7 @@ protected virtual void ReverserControlBackwards()
129129
{
130130
if (Locomotive.Direction != Direction.Reverse
131131
&& (Locomotive.ThrottlePercent >= 1
132-
|| Math.Abs(Locomotive.SpeedMpS) > 1))
132+
|| Math.Abs(Locomotive.SpeedMpS) > 1 || Locomotive.DynamicBrakeIntervention >= 0))
133133
{
134134
Viewer.Simulator.Confirmer.Warning(CabControl.Reverser, CabSetting.Warn1);
135135
return;

0 commit comments

Comments
 (0)