Skip to content

Commit 0c40efd

Browse files
committed
Fix : Passenger car power supply should not be available for locomotives
https://bugs.launchpad.net/or/+bug/1938611
1 parent 4d83c00 commit 0c40efd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,11 +1347,15 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
13471347
case "wagon(ortspowersupplyheatingpower":
13481348
case "wagon(ortspowersupplyairconditioningpower":
13491349
case "wagon(ortspowersupplyairconditioningyield":
1350-
if (PassengerCarPowerSupply == null)
1350+
if (this is MSTSLocomotive)
1351+
{
1352+
Trace.TraceWarning($"Defining the {lowercasetoken} parameter is forbidden for locomotives (in {stf.FileName}:line {stf.LineNumber})");
1353+
}
1354+
else if (PassengerCarPowerSupply == null)
13511355
{
13521356
PowerSupply = new ScriptedPassengerCarPowerSupply(this);
13531357
}
1354-
PassengerCarPowerSupply.Parse(lowercasetoken, stf);
1358+
PassengerCarPowerSupply?.Parse(lowercasetoken, stf);
13551359
break;
13561360

13571361
case "wagon(intakepoint": IntakePointList.Add(new IntakePoint(stf)); break;

0 commit comments

Comments
 (0)