Skip to content

Commit 32bb911

Browse files
committed
Correct reading of input parameters
1 parent a479616 commit 32bb911

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,16 @@ public virtual void LoadFromWagFile(string wagFilePath)
615615
// Initialise number of brake shoes per wagon
616616
if (NumberCarBrakeShoes == 0 && WagonType == WagonTypes.Engine)
617617
{
618-
NumberCarBrakeShoes = LocoNumDrvAxles * 4.0f; // Assume 4 brake shoes per axle
618+
var LocoTest = Simulator.PlayerLocomotive as MSTSLocomotive;
619+
620+
if (LocoTest != null && !LocoTest.DriveWheelOnlyBrakes)
621+
{
622+
NumberCarBrakeShoes = LocoNumDrvAxles * 4 + WagonNumAxles * 4; // Assume 4 brake shoes per axle on all wheels
623+
}
624+
else
625+
{
626+
NumberCarBrakeShoes = LocoNumDrvAxles * 4; // Assume 4 brake shoes per axle on drive wheels only
627+
}
619628

620629
if (Simulator.Settings.VerboseConfigurationMessages && (BrakeShoeType == BrakeShoeTypes.CastIron || BrakeShoeType == BrakeShoeTypes.HiFrictionCompost))
621630
{
@@ -624,7 +633,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
624633
}
625634
else if (NumberCarBrakeShoes == 0)
626635
{
627-
NumberCarBrakeShoes = WagonNumAxles * 4.0f; // Assume 4 brake shoes per axle
636+
NumberCarBrakeShoes = WagonNumAxles * 4; // Assume 4 brake shoes per axle
628637

629638
if (Simulator.Settings.VerboseConfigurationMessages && (BrakeShoeType == BrakeShoeTypes.CastIron || BrakeShoeType == BrakeShoeTypes.HiFrictionCompost))
630639
{
@@ -1173,7 +1182,7 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
11731182
case "wagon(maxhandbrakeforce": InitialMaxHandbrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
11741183
case "wagon(maxbrakeforce": InitialMaxBrakeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
11751184
case "wagon(ortsmaxbrakeshoeforce": MaxBrakeShoeForceN = stf.ReadFloatBlock(STFReader.UNITS.Force, null); break;
1176-
case "engine(ortsnumbercarbrakeshoes": NumberCarBrakeShoes = stf.ReadIntBlock(null); break;
1185+
case "wagon(ortsnumbercarbrakeshoes": NumberCarBrakeShoes = stf.ReadIntBlock(null); break;
11771186
case "wagon(ortsbrakeshoetype":
11781187
stf.MustMatch("(");
11791188
var brakeShoeType = stf.ReadString();

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
213213
public float MaxHandbrakeForceN;
214214
public float MaxBrakeForceN = 89e3f;
215215
public float MaxBrakeShoeForceN; // This is the force applied to the brake shoe, hence it will be decreased by CoF to give force applied to the wheel
216-
public float NumberCarBrakeShoes;
216+
public int NumberCarBrakeShoes;
217217
public float InitialMaxHandbrakeForceN; // Initial force when agon initialised
218218
public float InitialMaxBrakeForceN = 89e3f; // Initial force when wagon initialised, this is the force on the wheel, ie after the brake shoe.
219219

0 commit comments

Comments
 (0)