Skip to content

Commit 944aa92

Browse files
committed
Automatic merge of T1.5.1-799-gb02a6e5d3 and 13 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at a055bca: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 0a9d939: feat: Improved system information collection - Pull request #899 at f5a3bd8: Duplex steam engines - Booster Engine addition - Pull request #903 at 6c9da3f: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #908 at 4b4afe3: feat: supports switching adhesion precisions
15 parents d7da113 + b02a6e5 + 3539862 + d00beb9 + f92de76 + a055bca + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 0a9d939 + f5a3bd8 + 6c9da3f + 9b0b04f + 4b4afe3 commit 944aa92

File tree

1 file changed

+81
-8
lines changed

1 file changed

+81
-8
lines changed

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 81 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
using Orts.Simulation.RollingStocks.SubSystems.Brakes.MSTS;
2929
using Orts.Simulation.RollingStocks.SubSystems.PowerSupplies;
3030
using Orts.Simulation.RollingStocks.SubSystems.PowerTransmissions;
31+
using Orts.Simulation.Simulation.RollingStocks.SubSystems.PowerSupplies;
3132
using Orts.Viewer3D.Processes;
3233
using ORTS.Common;
3334
using ORTS.Scripting.Api;
@@ -583,6 +584,11 @@ void TextPageConsistInfo(TableData table)
583584
}
584585
}
585586

587+
/// <summary>
588+
/// Calculates Whyte noatation for the vehicle
589+
/// For duplex steam locomotives wheel axles can be grouped under the main object shape, and hence the multiple engines will be counted as a single grouping.
590+
/// For multiple engines, the number of wheels defined in the attached axles will be used to determine the axles in the "non-bogie" groupings.
591+
/// </summary>
586592
static string GetCarWhyteLikeNotation(TrainCar car)
587593
{
588594
if (car.WheelAxles.Count == 0)
@@ -591,18 +597,85 @@ static string GetCarWhyteLikeNotation(TrainCar car)
591597
var whyte = new List<string>();
592598
var currentCount = 0;
593599
var currentBogie = car.WheelAxles[0].BogieIndex;
594-
foreach (var axle in car.WheelAxles)
600+
bool PreviousAxlePart = true; // Assume a bogie
601+
602+
var steamloco = car as MSTSSteamLocomotive;
603+
604+
if (car is MSTSSteamLocomotive && steamloco.SteamEngines.Count > 1)
605+
{
606+
var i = 0; // Count for number of steam engines
607+
var axlesCount = 0;
608+
609+
foreach (var axle in car.WheelAxles)
610+
{
611+
if (!axle.Part.bogie) // if not a bogie then check for the number of axles.
612+
{
613+
if (currentBogie != axle.BogieIndex && currentCount != 0)
614+
{
615+
whyte.Add(currentCount.ToString());
616+
currentBogie = axle.BogieIndex;
617+
currentCount = 0;
618+
}
619+
620+
if (steamloco.SteamEngines[i].AuxiliarySteamEngineType != SteamEngine.AuxiliarySteamEngineTypes.Booster)
621+
{
622+
currentCount += 2;
623+
axlesCount += 1;
624+
625+
if (axlesCount >= steamloco.SteamEngines[i].AttachedAxle.NumberWheelAxles && currentCount != 0)
626+
{
627+
whyte.Add(currentCount.ToString());
628+
currentBogie = axle.BogieIndex;
629+
currentCount = 0;
630+
axlesCount = 0;
631+
i = i + 1;
632+
}
633+
}
634+
}
635+
else if (axle.Part.bogie) // this is a bogie
636+
{
637+
if ( PreviousAxlePart)
638+
{
639+
currentBogie = axle.BogieIndex;
640+
}
641+
642+
if (currentBogie != axle.BogieIndex && currentCount != 0)
643+
{
644+
whyte.Add(currentCount.ToString());
645+
currentBogie = axle.BogieIndex;
646+
currentCount = 0;
647+
}
648+
currentCount += 2;
649+
}
650+
651+
if (axle.Part.bogie)
652+
{
653+
PreviousAxlePart = true;
654+
}
655+
else
656+
{
657+
PreviousAxlePart = false;
658+
}
659+
}
660+
661+
whyte.Add(currentCount.ToString());
662+
return String.Join("-", whyte.ToArray());
663+
}
664+
else // default axle computation - used for most wheel configurations
595665
{
596-
if (currentBogie != axle.BogieIndex)
666+
foreach (var axle in car.WheelAxles)
597667
{
598-
whyte.Add(currentCount.ToString());
599-
currentBogie = axle.BogieIndex;
600-
currentCount = 0;
668+
if (currentBogie != axle.BogieIndex && currentCount != 0)
669+
{
670+
whyte.Add(currentCount.ToString());
671+
currentBogie = axle.BogieIndex;
672+
currentCount = 0;
673+
}
674+
currentCount += 2;
601675
}
602-
currentCount += 2;
676+
whyte.Add(currentCount.ToString());
677+
return String.Join("-", whyte.ToArray());
603678
}
604-
whyte.Add(currentCount.ToString());
605-
return String.Join("-", whyte.ToArray());
606679
}
607680

608681
void TextPageLocomotiveInfo(TableData table)

0 commit comments

Comments
 (0)