Exemplo n.º 1
0
 // --- constructors ---
 /// <summary>Creates a new instance of this system.</summary>
 /// <param name="train">The train.</param>
 /// <param name="automaticSwitch">Whether to switch automatically between ATS to ATC.</param>
 internal Atc(Train train, bool automaticSwitch)
 {
     this.Train = train;
     this.State = States.Disabled;
     this.CompatibilityState = CompatibilityStates.Ats;
     this.CompatibilityLimits = new List<CompatibilityLimit>();
     this.AutomaticSwitch = automaticSwitch;
 }
Exemplo n.º 2
0
        // --- constructors ---

        /// <summary>Creates a new instance of this system.</summary>
        /// <param name="train">The train.</param>
        /// <param name="automaticSwitch">Whether to switch automatically between ATS to ATC.</param>
        internal Atc(Train train, bool automaticSwitch)
        {
            this.Train = train;
            this.State = States.Disabled;
            this.CompatibilityState  = CompatibilityStates.Ats;
            this.CompatibilityLimits = new List <CompatibilityLimit>();
            this.AutomaticSwitch     = automaticSwitch;
        }
Exemplo n.º 3
0
        /// <summary>Is called when a beacon is passed.</summary>
        /// <param name="beacon">The beacon data.</param>
        internal override void SetBeacon(BeaconData beacon)
        {
            switch (beacon.Type)
            {
            case -16777215:
                if (beacon.Optional >= 0 & beacon.Optional <= 3)
                {
                    this.CompatibilityState = (CompatibilityStates)beacon.Optional;
                }
                break;

            case -16777214:
            {
                double             limit    = (double)(beacon.Optional & 4095) / 3.6;
                double             position = (beacon.Optional >> 12);
                CompatibilityLimit item     = new CompatibilityLimit(limit, position);
                if (!this.CompatibilityLimits.Contains(item))
                {
                    this.CompatibilityLimits.Add(item);
                }
            }
            break;
            }
        }
Exemplo n.º 4
0
 /// <summary>Is called when a beacon is passed.</summary>
 /// <param name="beacon">The beacon data.</param>
 internal override void SetBeacon(BeaconData beacon)
 {
     switch (beacon.Type) {
         case -16777215:
             if (beacon.Optional >= 0 & beacon.Optional <= 3) {
                 this.CompatibilityState = (CompatibilityStates)beacon.Optional;
             }
             break;
         case -16777214:
             {
                 double limit = (double)(beacon.Optional & 4095) / 3.6;
                 double position = (beacon.Optional >> 12);
                 CompatibilityLimit item = new CompatibilityLimit(limit, position);
                 if (!this.CompatibilityLimits.Contains(item)) {
                     this.CompatibilityLimits.Add(item);
                 }
             }
             break;
     }
 }