Skip to content

Commit d127b81

Browse files
committed
Automatic merge of T1.6-rc2-41-gacd714487 and 10 pull requests
- Pull request #1104 at 03ccdc6: Handle simple adhesion within the axle module - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1114 at 9a4a873: Fix color of DB in DrivingInfo when in setup with DPU fenced. (r1.6) - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1116 at 721d118: Fix Potential Hang in AnimatedPart.SetFrameWrap - Pull request #1118 at f1e0f35: Fix DPMode when last remote is moved to front. (r1.6) - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
12 parents 45270e2 + acd7144 + 03ccdc6 + e10390b + 2391bc0 + 387388e + 9a4a873 + 270f22f + 721d118 + f1e0f35 + 5845a1a + 689494b commit d127b81

File tree

1 file changed

+15
-0
lines changed
  • Source/Orts.Simulation/Simulation/Physics

1 file changed

+15
-0
lines changed

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,7 @@ public void DPMoveToFront()
16281628
if (LeadLocomotive == null || (LeadLocomotive as MSTSLocomotive).DPDynamicBrakeController == null)
16291629
return;
16301630
int idToMove = -1;
1631+
bool stillHasRemotes = false;
16311632
for (var i = 0; i < Cars.Count; i++)
16321633
{
16331634
if (!(Cars[i] is MSTSLocomotive))
@@ -1641,7 +1642,12 @@ public void DPMoveToFront()
16411642
Cars[i].RemoteControlGroup = 0;
16421643
else if (idToMove > -1 && Cars[i].RemoteControlGroup == 0)
16431644
Cars[i].RemoteControlGroup = 1;
1645+
1646+
if (Cars[i].RemoteControlGroup == 1)
1647+
stillHasRemotes = true;
16441648
}
1649+
if (!stillHasRemotes)
1650+
DPMode = 0;
16451651
}
16461652

16471653
/// <summary>
@@ -1656,6 +1662,7 @@ public void DPMoveToBack()
16561662
var dpDynamicBrakeCurrentNotch = MathHelper.Clamp((LeadLocomotive as MSTSLocomotive).DPDynamicBrakeController.GetNotch(dpDynamicBrakePercent/100), 0, 8);
16571663
var dpThrottleCurrentNotch = (LeadLocomotive as MSTSLocomotive).ThrottleController.CurrentNotch;
16581664
int idToMove = -1;
1665+
bool alreadyHasRemotes = false;
16591666
int idLead = LeadLocomotive != null ? (Cars[LeadLocomotiveIndex] as MSTSLocomotive).DPUnitID : -1;
16601667
for (var i = Cars.Count - 1; i >= 0; i--)
16611668
{
@@ -1667,6 +1674,7 @@ public void DPMoveToBack()
16671674
dpThrottlePercent = DPThrottlePercent;
16681675
dpDynamicBrakeCurrentNotch = (LeadLocomotive as MSTSLocomotive).DPDynamicBrakeController.CurrentNotch;
16691676
dpThrottleCurrentNotch = (LeadLocomotive as MSTSLocomotive).DPThrottleController.CurrentNotch;
1677+
alreadyHasRemotes = true;
16701678
continue;
16711679
}
16721680
if (idToMove == -1 && Cars[i].RemoteControlGroup == 0)
@@ -1686,6 +1694,13 @@ public void DPMoveToBack()
16861694
else if (idToMove > -1 && Cars[i].RemoteControlGroup == 1)
16871695
Cars[i].RemoteControlGroup = 0;
16881696
}
1697+
if (!alreadyHasRemotes)
1698+
{
1699+
if (LeadLocomotive.ThrottlePercent > 0)
1700+
DPMode = 1;
1701+
else if (LeadLocomotive.DynamicBrakePercent >= 0) // off is -1
1702+
DPMode = -1;
1703+
}
16891704
}
16901705

16911706
/// <summary>

0 commit comments

Comments
 (0)