Skip to content

Commit e24a796

Browse files
committed
Distributed power: manage yellow colour for dynamic brake display
1 parent 7ff949b commit e24a796

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,25 +990,32 @@ public string GetDpuStatus(bool dataDpu, CABViewControlUnits loadUnits = CABView
990990
{
991991
data = (data / MaxDynamicBrakeForceN) * DynamicBrakeMaxCurrentA;
992992
}
993-
status.AppendFormat("{0:F0} amps\t", data);
993+
status.AppendFormat("{0:F0} amps", data);
994994
break;
995995

996996
case CABViewControlUnits.NEWTONS:
997-
status.AppendFormat("{0:F0} N\t", data);
997+
status.AppendFormat("{0:F0} N", data);
998998
break;
999999

10001000
case CABViewControlUnits.KILO_NEWTONS:
10011001
data = data / 1000.0f;
1002-
status.AppendFormat("{0:F0} kN\t", data);
1002+
status.AppendFormat("{0:F0} kN", data);
1003+
break;
1004+
1005+
case CABViewControlUnits.LBS:
1006+
data = N.ToLbf(data);
1007+
status.AppendFormat("{0:F0} lbf", data);
10031008
break;
10041009

10051010
case CABViewControlUnits.KILO_LBS:
10061011
default:
10071012
data = N.ToLbf(data) * 0.001f;
1008-
status.AppendFormat("{0:F0} klbf\t", data);
1013+
status.AppendFormat("{0:F0} klbf", data);
10091014
break;
10101015
}
10111016

1017+
status.AppendFormat((data < 0 ? "???" : " ") + "\t");
1018+
10121019
// BP
10131020
var brakeInfoValue = brakeValue(Simulator.Catalog.GetString("BP"), Simulator.Catalog.GetString("EOT"));
10141021
status.AppendFormat("{0:F0}\t", brakeInfoValue);

Source/RunActivity/Viewer3D/RollingStock/SubSystems/DistributedPowerInterface.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,12 @@ public override void PrepareFrame(DPIStatus dpiStatus)
473473
tempStatus[k, 0] = fence + status[0].Split('(').First();
474474
for (var j = 1; j < status.Length; j++)
475475
{
476-
// fence
477476
tempStatus[k, j] = fence + status[j].Split(' ').First();
477+
// move color code from after the Units to after the value
478+
if (ColorCodeCtrl.Keys.Any(status[j].EndsWith) && !ColorCodeCtrl.Keys.Any(tempStatus[k, j].EndsWith))
479+
{
480+
tempStatus[k, j] += status[j].Substring(status[j].Length - 3);
481+
}
478482
}
479483
dpUId = (train.Cars[i] as MSTSLocomotive).DPUnitID;
480484
k++;

0 commit comments

Comments
 (0)