Esempio n. 1
0
        public void Restore(BinaryReader inf)
        {
            EngineStatus         = (Status)inf.ReadInt32();
            RealRPM              = inf.ReadSingle();
            OutputPowerW         = inf.ReadSingle();
            DieselTemperatureDeg = inf.ReadSingle();

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

            if (((MSTSDieselLocomotive)locomotive).GearBox != null)
            {
                if (!((MSTSDieselLocomotive)locomotive).GearBox.IsInitialized || !gearSaved)
                {
                    GearBox = null;
                }
                else
                {
                    GearBox = new GearBox(((MSTSDieselLocomotive)locomotive).GearBox, this);
                    GearBox.Restore(inf);
                    gearRestored = true;
                }
            }

            // if info was saved but not restored - use dummy to load restored info
            if (gearSaved && !gearRestored)
            {
                GearBox dummyGear = new GearBox();
                dummyGear.Restore(inf);
            }
        }
Esempio n. 2
0
        public void Restore(BinaryReader inf)
        {
            EngineStatus         = (Status)inf.ReadInt32();
            RealRPM              = inf.ReadSingle();
            OutputPowerW         = inf.ReadSingle();
            DieselTemperatureDeg = inf.ReadSingle();

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

            if (((MSTSDieselLocomotive)locomotive).GearBox != null)
            {
                if (!((MSTSDieselLocomotive)locomotive).GearBox.IsInitialized || !gearSaved)
                {
                    GearBox = null;
                }
                else
                {
                    GearBox.Restore(inf);
                }
            }
        }