Skip to content

Commit 750ead7

Browse files
authored
Merge pull request #603 from mbm-OR/bugfix/Fix-HUD-DPinfo
Bug fix for https://bugs.launchpad.net/or/+bug/1961304. HUD - DPI extended page, misaligned.
2 parents 88d0be9 + 7db2d0f commit 750ead7

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,9 @@ public string GetDPDebugStatus()
919919

920920
var status = new StringBuilder();
921921
status.AppendFormat("{0}({1})\t", CarID, DPUnitID);
922+
status.AppendFormat("{0}\t", throttle);
922923
status.AppendFormat("{0} {1}\t", GetStringAttribute.GetPrettyName(Direction), Flipped ? Simulator.Catalog.GetString("(flipped)") : "");
923924
status.AppendFormat("{0}\t", IsLeadLocomotive() || RemoteControlGroup < 0 ? "———" : RemoteControlGroup == 0 ? Simulator.Catalog.GetString("Sync") : Simulator.Catalog.GetString("Async"));
924-
status.AppendFormat("{0}\t", throttle);
925925
status.AppendFormat("{0}\t", FormatStrings.FormatFuelVolume(DieselLevelL, IsMetric, IsUK));
926926
status.AppendFormat("{0}{1}", FormatStrings.FormatForce(MotiveForceN, IsMetric), CouplerOverloaded ? "???" : "");
927927
status.Append(DieselEngines.GetDPStatus());
@@ -1098,17 +1098,16 @@ public override string GetMultipleUnitsConfiguration()
10981098
private static string[] DpuLabels;
10991099
private static string[] DPULabels;
11001100

1101-
private static void SetDebugLabels(int numberOfEngines)
1101+
private static void SetDebugLabels()
11021102
{
1103-
MaxNumberOfEngines = numberOfEngines;
11041103
var labels = new StringBuilder();
11051104
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("ID"));
11061105
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Throttle"));
11071106
labels.AppendFormat("{0}\t", Simulator.Catalog.GetParticularString("NonSteam", "Reverser"));
11081107
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Remote"));
11091108
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Fuel"));
11101109
labels.AppendFormat("{0}\t", Simulator.Catalog.GetString("Tractive Effort"));
1111-
labels.Append(DieselEngines.SetDebugLabels(numberOfEngines));
1110+
labels.Append(DieselEngines.SetDebugLabels());
11121111
DebugLabels = labels.ToString().Split('\t');
11131112
}
11141113

@@ -1135,10 +1134,11 @@ private static void SetDPULabels(bool dpuFull, int numberOfEngines)
11351134
}
11361135
}
11371136

1138-
public static string GetDebugTableBase(int locomotivesInTrain, int maxNumberOfEngines)
1137+
public static string GetDebugTableBase(int locomotivesInTrain)
11391138
{
1140-
if (MaxNumberOfEngines != maxNumberOfEngines || DebugLabels == null)
1141-
SetDebugLabels(maxNumberOfEngines);
1139+
if (DebugLabels == null)
1140+
SetDebugLabels();
1141+
11421142
string table = "";
11431143
for (var i = 0; i < DebugLabels.Length; i++)
11441144
{

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/DieselEngine.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,11 +377,10 @@ public DieselEnum GetEnumerator()
377377
return new DieselEnum(DEList.ToArray());
378378
}
379379

380-
public static string SetDebugLabels(int numberOfEngines)
380+
public static string SetDebugLabels()
381381
{
382382
var labels = new StringBuilder();
383383
var tabs = "\t";
384-
for (var i = 1; i < numberOfEngines; i++) tabs += "\t";
385384
labels.AppendFormat("{0}{1}", Simulator.Catalog.GetString("Status"), tabs);
386385
labels.AppendFormat("{0}{1}", Simulator.Catalog.GetParticularString("HUD", "Power"), tabs);
387386
labels.AppendFormat("{0}{1}", Simulator.Catalog.GetString("Load"), tabs);

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,19 +718,17 @@ void TextPageDistributedPowerInfo(TableData table)
718718
var train = locomotive.Train;
719719

720720
int numberOfDieselLocomotives = 0;
721-
int maxNumberOfEngines = 0;
722721
for (var i = 0; i<train.Cars.Count; i++)
723722
{
724723
if (train.Cars[i] is MSTSDieselLocomotive)
725724
{
726725
numberOfDieselLocomotives++;
727-
maxNumberOfEngines = Math.Max(maxNumberOfEngines, (train.Cars[i] as MSTSDieselLocomotive).DieselEngines.Count);
728726
}
729727
}
730728
if (numberOfDieselLocomotives > 0)
731729
{
732730
var row = table.CurrentRow;
733-
TableAddLines(table, MSTSDieselLocomotive.GetDebugTableBase(numberOfDieselLocomotives, maxNumberOfEngines));
731+
TableAddLines(table, MSTSDieselLocomotive.GetDebugTableBase(numberOfDieselLocomotives));
734732
var k = 0;
735733
var dpUnitId = 0;
736734
for (var i = 0; i<train.Cars.Count; i++)

0 commit comments

Comments
 (0)