internal void SetBeacon(BeaconData beacon) { if (beacon.Type == BeaconID.TrackGradientMemory.TrackGradientPoint) { int param_trackPos = Math.Abs(beacon.Optional % 1000000); int param_gradient = beacon.Optional / 1000000; int idxOfGradientPtAtHere = _gPtC.IndexOf(param_trackPos); if (idxOfGradientPtAtHere > -1) { _gPtC[idxOfGradientPtAtHere] = new GradientPoint(param_gradient, param_trackPos); } else { _gPtC.Add(new GradientPoint(param_gradient, param_trackPos)); } OnGradientPointsDataRefreshed(_gPtC); } }
internal override void SetBeacon(BeaconData beacon) { if (beacon.Type == 33) //Distance to stop point { atoReceivedData = beacon.Optional; } //Central Line ATP if (beacon.Type == 6) { atoReceivedData = beacon.Optional % 1000; } }
/// <summary>Is called when a beacon is passed.</summary> /// <param name="beacon">The beacon data.</param> internal override void SetBeacon(BeaconData beacon) { if (this.State != States.Disabled & this.State != States.Suppressed & this.State != States.Initializing) { switch (beacon.Type) { case 0: case 1: // --- P -> S --- if (beacon.Optional == 0) { if (this.State == States.Normal | this.State == States.Pattern | this.State == States.Brake) { SwitchToSx(); } } break; case 3: case 4: // --- P pattern / P immediate stop --- this.Position = this.Train.State.Location; if (this.State != States.Service & this.State != States.Emergency) { if (this.State == States.Standby & (beacon.Type != 3 | beacon.Optional != -1)) { SwitchToP(States.Normal); } if (this.State != States.Standby) { if (beacon.Signal.Aspect == 0) { this.SignalPattern.SetSignal(this.Position + beacon.Signal.Distance - SignalOffset); if (beacon.Type != 3 & beacon.Signal.Distance < 50.0 & !BrakeRelease) { SwitchToP(States.Emergency); } } else { this.SignalPattern.Clear(); } } } break; } } switch (beacon.Type) { case -16777213: // --- compatibility temporary pattern --- { 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; case -16777212: // --- compatibility permanent pattern --- if (beacon.Optional == 0) { this.CompatibilityPermanentPattern.Clear(); } else { double limit = (double)beacon.Optional / 3.6; this.CompatibilityPermanentPattern.SetLimit(limit, double.MinValue); } break; } }
internal void SetBeacon(BeaconData beacon) { if (beacon.Type == BeaconID.StationsMemory.StationStopProvider) { int param_doorside = beacon.Optional / 10000000; bool param_tbsStart = Math.Abs(beacon.Optional / 1000000 - param_doorside * 10) == 1 ? true : false; int param_trackPos = Math.Abs(beacon.Optional - param_doorside * 10000000 - (param_tbsStart ? 1000000 : 0)); int idxOfStopAtHere = Stations.IndexOf(param_trackPos); if (idxOfStopAtHere > -1) { // stop exists Stations[idxOfStopAtHere] = new Station(param_doorside, param_trackPos, param_tbsStart); } else { // stop not exist, add one then Stations.Add(new Station(param_doorside, param_trackPos, param_tbsStart)); } OnStationDataRefreshed(Stations); } }
internal override void SetBeacon(BeaconData beacon) { if (beacon.Type == 31) //Target and safety track speeds { train.atpTrackTargetSpeed = beacon.Optional / 1000; train.atpTrackSafetySpeed = beacon.Optional % 1000; } }
internal void SetBeacon(BeaconData beacon) { switch (beacon.Type) { case BeaconID.HKHRATP2.EnDisableCabSignal: OnCabSignallingSection = Convert.ToBoolean(beacon.Optional); break; case BeaconID.HKHRATP2.SpeedFlag: if (OnCabSignallingSection && beacon.Optional >= 0) { int speed = beacon.Optional / 1000000; int startloc = beacon.Optional - (speed * 1000000); SpeedFlags.Add(new SpeedFlag(speed, startloc)); SpeedFlags.Sort(); } break; } }
/// <summary>Is called when a beacon is passed.</summary> /// <param name="beacon">The beacon data.</param> internal override void SetBeacon(BeaconData beacon) { if (this.State != States.Disabled & this.State != States.Initializing) { switch (beacon.Type) { case 0: // --- Sx long --- if (beacon.Signal.Aspect == 0) { if (this.State == States.Chime | this.State == States.Normal) { this.AlarmCountdown = DurationOfAlarm; this.State = States.Alarm; UpdateRedSignalLocation(beacon); } } break; case 1: // --- Sx immediate stop --- if (beacon.Signal.Aspect == 0) { if (this.State == States.Chime | this.State == States.Normal | this.State == States.Alarm) { this.State = States.Emergency; } } break; case 2: // --- accidental departure --- if (beacon.Signal.Aspect == 0 & (beacon.Optional == 0 | beacon.Optional >= this.Train.Specs.Cars)) { if (this.State == States.Chime | this.State == States.Normal | this.State == States.Alarm) { this.State = States.Emergency; } } break; } } }
/// <summary>Is called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> public void SetBeacon(BeaconData beacon) { // TODO: Your old SetBeaconData code goes here. }
/// <summary>Is called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> public void SetBeacon(BeaconData beacon) { closedSignalDevice.trainEvent(new TrainEvent(EventTypes.EventTypeGetBeacon, beacon)); speedControl.trainEvent(new TrainEvent(EventTypes.EventTypeGetBeacon, beacon)); }
public void SetBeacon(BeaconData beacon) { atp2.SetBeacon(beacon); stationsMemory.SetBeacon(beacon); trackGradientMemory.SetBeacon(beacon); }
/// <summary>Is called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> public void SetBeacon(BeaconData beacon) { foreach (Script script in this.Scripts) { for (int i = 0; i < script.Events.Count; i++) { BeaconEvent f = script.Events[i] as BeaconEvent; if (f != null && f.Type.IsMember(beacon.Type) && f.Signal.IsMember(beacon.Signal.Aspect)) { f.Trigger(); } } } }
/// <summary>Is called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> public void SetBeacon(BeaconData beacon) { ms.SetBeacon(beacon); }
internal void SetBeacon(BeaconData beacons) { foreach (Device device in devices.Values) { device.SetBeacon(beacons); } }
/// <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; } }
/// <summary>Is called when a beacon is passed.</summary> /// <param name="beacon">The beacon data.</param> internal override void SetBeacon(BeaconData beacon) { }
/// <summary>Is called when a beacon is passed.</summary> /// <param name="beacon">The beacon data.</param> internal void SetBeacon(BeaconData beacon) { foreach (Device device in this.Devices) { device.SetBeacon(beacon); } }
internal override void SetBeacon(BeaconData beacon) { // if (this.Train == TrainManager.PlayerTrain) { // Game.AddDebugMessage("Beacon, type=" + beacon.Type.ToString() + ", aspect=" + beacon.Signal.Aspect.ToString() + ", data=" + beacon.Optional.ToString(), 3.0); // } #if !DEBUG try { #endif this.Api.SetBeacon(beacon); #if !DEBUG } catch (Exception ex) { base.LastException = ex; throw; } #endif }
/// <summary>Called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> /// <remarks>This function should not be called directly. Call UpdateBeacon instead.</remarks> internal abstract void SetBeacon(BeaconData beacon);
internal override void SetBeacon(BeaconData beacon) { try { Win32BeaconData win32Beacon; win32Beacon.Type = beacon.Type; win32Beacon.Signal = beacon.Signal.Aspect; win32Beacon.Distance = (float)beacon.Signal.Distance; win32Beacon.Optional = beacon.Optional; Win32SetBeaconData(ref win32Beacon.Type); } catch (Exception ex) { base.LastException = ex; throw; } }
// --- private functions --- /// <summary>Updates the location of the farthest known red signal from the specified beacon.</summary> /// <param name="beacon">The beacon that holds the distance to a known red signal.</param> private void UpdateRedSignalLocation(BeaconData beacon) { if (beacon.Signal.Distance < 1200.0) { double signalLocation = this.Train.State.Location + beacon.Signal.Distance; if (signalLocation > this.RedSignalLocation) { this.RedSignalLocation = signalLocation; } } }
/// <summary>Is called when the train passes a beacon.</summary> /// <param name="beacon">The beacon data.</param> public void SetBeacon(BeaconData beacon) { this.Train.SetBeacon(beacon); }