Skip to content

Commit 3cfe7c9

Browse files
authored
Merge pull request #1114 from rwf-rr/fix-db-setup-color-with-dpu
Fix color of DB in DrivingInfo when in setup with DPU fenced. (r1.6)
2 parents 45562fa + 9a4a873 commit 3cfe7c9

File tree

2 files changed

+37
-28
lines changed

2 files changed

+37
-28
lines changed

Source/RunActivity/Viewer3D/Popups/TrainDrivingWindow.cs

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ void AddSeparator() => AddLabel(new ListLabel
771771
{
772772
FirstCol = Viewer.Catalog.GetString(locomotive is MSTSSteamLocomotive ? "Regulator" : "Throttle"),
773773
LastCol = $"{Round(locomotive.ThrottlePercent)}%" +
774-
(locomotive is MSTSDieselLocomotive && train.DPMode == 1 ? $"({Round(train.DPThrottlePercent)}%)" : ""),
774+
(locomotive is MSTSDieselLocomotive && train.DPMode == 1 ? $" | {Round(train.DPThrottlePercent)}%" : ""),
775775
KeyPressed = throttleKey,
776776
SymbolCol = ""//throttleKey,
777777
});
@@ -1048,23 +1048,27 @@ void AddSeparator() => AddLabel(new ListLabel
10481048

10491049
if (dynamicBrakeStatus != null && locomotive.IsLeadLocomotive())
10501050
{
1051-
if (locomotive.DynamicBrakePercent >= 0)
1051+
var dynBrakeString = "";
1052+
var dynBrakeColor = "";
1053+
1054+
if (locomotive.DynamicBrakePercent < 0)
1055+
dynBrakeString = Viewer.Catalog.GetString("Off");
1056+
else if (!locomotive.DynamicBrake)
10521057
{
1053-
AddLabel(new ListLabel
1054-
{
1055-
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
1056-
LastCol = locomotive.DynamicBrake ? dynamicBrakeStatus : Viewer.Catalog.GetString("Setup") + ColorCode[Color.Cyan] +
1057-
(locomotive is MSTSDieselLocomotive && train.DPMode == -1 ? string.Format("({0:F0}%)", train.DPDynamicBrakePercent) : string.Empty),
1058-
});
1058+
dynBrakeString = Viewer.Catalog.GetString("Setup");
1059+
dynBrakeColor = ColorCode[Color.Cyan];
10591060
}
10601061
else
1062+
dynBrakeString = dynamicBrakeStatus;
1063+
1064+
if (locomotive is MSTSDieselLocomotive && train.DPMode == -1)
1065+
dynBrakeString += string.Format(" | {0:F0}%", train.DPDynamicBrakePercent);
1066+
1067+
AddLabel(new ListLabel
10611068
{
1062-
AddLabel(new ListLabel
1063-
{
1064-
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
1065-
LastCol = Viewer.Catalog.GetString("Off") + (locomotive is MSTSDieselLocomotive && train.DPMode == -1 ? string.Format("({0:F0}%)", train.DPDynamicBrakePercent) : string.Empty),
1066-
});
1067-
}
1069+
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
1070+
LastCol = dynBrakeString + dynBrakeColor,
1071+
});
10681072
}
10691073

10701074
AddSeparator();

Source/RunActivity/Viewer3D/WebServices/TrainDrivingDisplay.cs

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ void AddSeparator() => AddLabel(new ListLabel
314314
AddLabel(new ListLabel
315315
{
316316
FirstCol = Viewer.Catalog.GetString(locomotive is MSTSSteamLocomotive ? "Regulator" : "Throttle"),
317-
LastCol = $"{Round(locomotive.ThrottlePercent)}%",
317+
LastCol = $"{Round(locomotive.ThrottlePercent)}%" +
318+
(locomotive is MSTSDieselLocomotive && train.DPMode == 1 ? $" | {Round(train.DPThrottlePercent)}%" : ""),
318319
KeyPressed = throttleKey,
319320
SymbolCol = throttleKey,
320321
});
@@ -589,23 +590,27 @@ void AddSeparator() => AddLabel(new ListLabel
589590

590591
if (dynamicBrakeStatus != null && locomotive.IsLeadLocomotive())
591592
{
592-
if (locomotive.DynamicBrakePercent >= 0)
593+
var dynBrakeString = "";
594+
var dynBrakeColor = "";
595+
596+
if (locomotive.DynamicBrakePercent < 0)
597+
dynBrakeString = Viewer.Catalog.GetString("Off");
598+
else if (!locomotive.DynamicBrake)
593599
{
594-
AddLabel(new ListLabel
595-
{
596-
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
597-
LastCol = locomotive.DynamicBrake ? dynamicBrakeStatus : Viewer.Catalog.GetString("Setup") + ColorCode[Color.Cyan] +
598-
(locomotive is MSTSDieselLocomotive && train.DPMode == -1 ? string.Format("({0:F0}%)", train.DPDynamicBrakePercent) : string.Empty),
599-
});
600+
dynBrakeString = Viewer.Catalog.GetString("Setup");
601+
dynBrakeColor = ColorCode[Color.Cyan];
600602
}
601603
else
604+
dynBrakeString = dynamicBrakeStatus;
605+
606+
if (locomotive is MSTSDieselLocomotive && train.DPMode == -1)
607+
dynBrakeString += string.Format(" | {0:F0}%", train.DPDynamicBrakePercent);
608+
609+
AddLabel(new ListLabel
602610
{
603-
AddLabel(new ListLabel
604-
{
605-
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
606-
LastCol = Viewer.Catalog.GetString("Off") + (locomotive is MSTSDieselLocomotive && train.DPMode == -1 ? string.Format("({0:F0}%)", train.DPDynamicBrakePercent) : string.Empty),
607-
});
608-
}
611+
FirstCol = Viewer.Catalog.GetString("Dynamic brake"),
612+
LastCol = dynBrakeString + dynBrakeColor,
613+
});
609614
}
610615

611616
AddSeparator();

0 commit comments

Comments
 (0)