Esempio n. 1
0
        /// <summary>
        /// Restores the general variable parameters
        /// Called from within the Simulator class.
        /// </summary>
        public virtual void Restore(BinaryReader inf, Simulator simulator)
        {
            Continuous         = inf.ReadBoolean();
            GoToTarget         = inf.ReadBoolean();
            GoToAutoTarget     = inf.ReadBoolean();
            TurntableFrameRate = null;
            if (inf.ReadBoolean())
            {
                TurntableFrameRate = inf.ReadInt32();
            }
            ConnectedTrackEnd = inf.ReadInt32();
            SendNotifications = inf.ReadBoolean();
            InUse             = inf.ReadBoolean();
            RelativeFrontTravellerXNALocation = RestoreVector(inf);
            RelativeRearTravellerXNALocation  = RestoreVector(inf);
            FinalFrontTravellerXNALocation    = RestoreVector(inf);
            FinalRearTravellerXNALocation     = RestoreVector(inf);
            var trainsOnMovingTable = inf.ReadInt32();

            while (trainsOnMovingTable > 0)
            {
                TrainOnMovingTable trainOnMovingTable = new TrainOnMovingTable(simulator);
                trainOnMovingTable.Restore(inf);
                trainsOnMovingTable--;
                TrainsOnMovingTable.Add(trainOnMovingTable);
            }

            int trainsInQ = inf.ReadInt32();

            for (int iQ = 0; iQ < trainsInQ - 1; iQ++)
            {
                Q.Enqueue(iQ);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Restores the general variable parameters
        /// Called from within the Simulator class.
        /// </summary>
        public virtual void Restore(BinaryReader inf, Simulator simulator)
        {
            Continuous        = inf.ReadBoolean();
            GoToTarget        = inf.ReadBoolean();
            ConnectedTrackEnd = inf.ReadInt32();
            RelativeFrontTravellerXNALocation = RestoreVector(inf);
            RelativeRearTravellerXNALocation  = RestoreVector(inf);
            FinalFrontTravellerXNALocation    = RestoreVector(inf);
            FinalRearTravellerXNALocation     = RestoreVector(inf);
            var trainsOnMovingTable = inf.ReadInt32();

            while (trainsOnMovingTable > 0)
            {
                TrainOnMovingTable trainOnMovingTable = new TrainOnMovingTable(simulator);
                trainOnMovingTable.Restore(inf);
                trainsOnMovingTable--;
                TrainsOnMovingTable.Add(trainOnMovingTable);
            }
        }