Skip to content

Commit

Permalink
Further adjustment to save/restore of DM
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewell committed Aug 30, 2022
1 parent 5ab0e7e commit 2290a17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
21 changes: 2 additions & 19 deletions Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs
Expand Up @@ -1267,6 +1267,7 @@ public override void Save(BinaryWriter outf)
outf.Write(RemoteControlGroup);
outf.Write(DPUnitID);
outf.Write(PreviousGearBoxNotch);
outf.Write(previousChangedGearBoxNotch);

base.Save(outf);

Expand Down Expand Up @@ -1321,6 +1322,7 @@ public override void Restore(BinaryReader inf)
RemoteControlGroup = inf.ReadInt32();
DPUnitID = inf.ReadInt32();
PreviousGearBoxNotch = inf.ReadInt32();
previousChangedGearBoxNotch = inf.ReadInt32();

base.Restore(inf);

Expand Down Expand Up @@ -3672,10 +3674,6 @@ public virtual void StartGearBoxIncrease()
AlerterReset(TCSEvent.GearBoxChanged);
SignalGearBoxChangeEvents();
}

// ChangeGearUp();


}
}

Expand Down Expand Up @@ -3739,21 +3737,6 @@ public virtual void StartGearBoxDecrease()
SignalGearBoxChangeEvents();

}

// pass gearbox command to other locomotives
foreach (TrainCar car in Train.Cars)
{
var locog = car as MSTSDieselLocomotive;

if (locog != null && car != this && locog.DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
{
locog.GearBoxController.StartDecrease();
locog.Simulator.Confirmer.ConfirmWithPerCent(CabControl.GearBox, CabSetting.Decrease, GearBoxController.CurrentNotch);
locog.AlerterReset(TCSEvent.GearBoxChanged);
locog.SignalGearBoxChangeEvents();
}

}
}
}

Expand Down
Expand Up @@ -1638,6 +1638,7 @@ public void Restore(BinaryReader inf)
RealRPM = inf.ReadSingle();
OutputPowerW = inf.ReadSingle();
DieselTemperatureDeg = inf.ReadSingle();
GovernorEnabled = inf.ReadBoolean();

Locomotive.gearSaved = inf.ReadBoolean(); // read boolean which indicates gear data was saved

Expand All @@ -1654,6 +1655,8 @@ public void Save(BinaryWriter outf)
outf.Write(RealRPM);
outf.Write(OutputPowerW);
outf.Write(DieselTemperatureDeg);
outf.Write(GovernorEnabled);

if (GearBox != null)
{
outf.Write(true);
Expand Down

0 comments on commit 2290a17

Please sign in to comment.