Skip to content

Commit 9668051

Browse files
committed
Fix gearbox not initialized
1 parent 1748e36 commit 9668051

File tree

1 file changed

+2
-18
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies

1 file changed

+2
-18
lines changed

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

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,14 +1586,7 @@ public void Restore(BinaryReader inf)
15861586
OutputPowerW = inf.ReadSingle();
15871587
DieselTemperatureDeg = inf.ReadSingle();
15881588
GovernorEnabled = inf.ReadBoolean();
1589-
1590-
bool gearSaved = inf.ReadBoolean(); // read boolean which indicates gear data was saved
1591-
1592-
if (gearSaved)
1593-
{
1594-
GearBox = new GearBox(this);
1595-
GearBox.Restore(inf);
1596-
}
1589+
GearBox?.Restore(inf);
15971590
}
15981591

15991592
public void Save(BinaryWriter outf)
@@ -1603,16 +1596,7 @@ public void Save(BinaryWriter outf)
16031596
outf.Write(OutputPowerW);
16041597
outf.Write(DieselTemperatureDeg);
16051598
outf.Write(GovernorEnabled);
1606-
1607-
if (GearBox != null)
1608-
{
1609-
outf.Write(true);
1610-
GearBox.Save(outf);
1611-
}
1612-
else
1613-
{
1614-
outf.Write(false);
1615-
}
1599+
GearBox?.Save(outf);
16161600
}
16171601

16181602
/// <summary>

0 commit comments

Comments
 (0)