Example #1
0
 internal static void AddBlackBoxEntry(BlackBoxEventToken EventToken)
 {
     if (Interface.CurrentOptions.BlackBox) {
         if (BlackBoxEntryCount >= BlackBoxEntries.Length) {
             Array.Resize<BlackBoxEntry>(ref BlackBoxEntries, BlackBoxEntries.Length << 1);
         }
         int d = TrainManager.PlayerTrain.DriverCar;
         BlackBoxEntries[BlackBoxEntryCount].Time = SecondsSinceMidnight;
         BlackBoxEntries[BlackBoxEntryCount].Position = TrainManager.PlayerTrain.Cars[0].FrontAxle.Follower.TrackPosition;
         BlackBoxEntries[BlackBoxEntryCount].Speed = (float)TrainManager.PlayerTrain.Specs.CurrentAverageSpeed;
         BlackBoxEntries[BlackBoxEntryCount].Acceleration = (float)TrainManager.PlayerTrain.Specs.CurrentAverageAcceleration;
         BlackBoxEntries[BlackBoxEntryCount].ReverserDriver = (short)TrainManager.PlayerTrain.Specs.CurrentReverser.Driver;
         BlackBoxEntries[BlackBoxEntryCount].ReverserSafety = (short)TrainManager.PlayerTrain.Specs.CurrentReverser.Actual;
         BlackBoxEntries[BlackBoxEntryCount].PowerDriver = (BlackBoxPower)TrainManager.PlayerTrain.Specs.CurrentPowerNotch.Driver;
         BlackBoxEntries[BlackBoxEntryCount].PowerSafety = (BlackBoxPower)TrainManager.PlayerTrain.Specs.CurrentPowerNotch.Safety;
         if (TrainManager.PlayerTrain.Specs.CurrentEmergencyBrake.Driver) {
             BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Emergency;
         } else if (TrainManager.PlayerTrain.Specs.CurrentHoldBrake.Driver) {
             BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.HoldBrake;
         } else if (TrainManager.PlayerTrain.Cars[d].Specs.BrakeType == TrainManager.CarBrakeType.AutomaticAirBrake) {
             switch (TrainManager.PlayerTrain.Specs.AirBrake.Handle.Driver) {
                     case TrainManager.AirBrakeHandleState.Release: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Release; break;
                     case TrainManager.AirBrakeHandleState.Lap: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Lap; break;
                     case TrainManager.AirBrakeHandleState.Service: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Service; break;
                     default: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Emergency; break;
             }
         } else {
             BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = (BlackBoxBrake)TrainManager.PlayerTrain.Specs.CurrentBrakeNotch.Driver;
         }
         if (TrainManager.PlayerTrain.Specs.CurrentEmergencyBrake.Safety) {
             BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Emergency;
         } else if (TrainManager.PlayerTrain.Specs.CurrentHoldBrake.Actual) {
             BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.HoldBrake;
         } else if (TrainManager.PlayerTrain.Cars[d].Specs.BrakeType == TrainManager.CarBrakeType.AutomaticAirBrake) {
             switch (TrainManager.PlayerTrain.Specs.AirBrake.Handle.Safety) {
                     case TrainManager.AirBrakeHandleState.Release: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Release; break;
                     case TrainManager.AirBrakeHandleState.Lap: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Lap; break;
                     case TrainManager.AirBrakeHandleState.Service: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Service; break;
                     default: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Emergency; break;
             }
         } else {
             BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = (BlackBoxBrake)TrainManager.PlayerTrain.Specs.CurrentBrakeNotch.Safety;
         }
         BlackBoxEntries[BlackBoxEntryCount].EventToken = EventToken;
         BlackBoxEntryCount++;
     }
 }
Example #2
0
        internal static void AddBlackBoxEntry(BlackBoxEventToken EventToken)
        {
            if (Interface.CurrentOptions.BlackBox)
            {
                if (BlackBoxEntryCount >= BlackBoxEntries.Length)
                {
                    Array.Resize <BlackBoxEntry>(ref BlackBoxEntries, BlackBoxEntries.Length << 1);
                }
                BlackBoxEntries[BlackBoxEntryCount].Time           = Program.CurrentRoute.SecondsSinceMidnight;
                BlackBoxEntries[BlackBoxEntryCount].Position       = TrainManager.PlayerTrain.Cars[0].TrackPosition;
                BlackBoxEntries[BlackBoxEntryCount].Speed          = (float)TrainManager.PlayerTrain.CurrentSpeed;
                BlackBoxEntries[BlackBoxEntryCount].Acceleration   = (float)TrainManager.PlayerTrain.Specs.CurrentAverageAcceleration;
                BlackBoxEntries[BlackBoxEntryCount].ReverserDriver = (short)TrainManager.PlayerTrain.Handles.Reverser.Driver;
                BlackBoxEntries[BlackBoxEntryCount].ReverserSafety = (short)TrainManager.PlayerTrain.Handles.Reverser.Actual;
                BlackBoxEntries[BlackBoxEntryCount].PowerDriver    = (BlackBoxPower)TrainManager.PlayerTrain.Handles.Power.Driver;
                BlackBoxEntries[BlackBoxEntryCount].PowerSafety    = (BlackBoxPower)TrainManager.PlayerTrain.Handles.Power.Safety;
                if (TrainManager.PlayerTrain.Handles.EmergencyBrake.Driver)
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Emergency;
                }
                else if (TrainManager.PlayerTrain.Handles.HoldBrake.Driver)
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.HoldBrake;
                }
                else if (TrainManager.PlayerTrain.Handles.Brake is TrainManager.AirBrakeHandle)
                {
                    switch ((TrainManager.AirBrakeHandleState)TrainManager.PlayerTrain.Handles.Brake.Driver)
                    {
                    case TrainManager.AirBrakeHandleState.Release: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Release; break;

                    case TrainManager.AirBrakeHandleState.Lap: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Lap; break;

                    case TrainManager.AirBrakeHandleState.Service: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Service; break;

                    default: BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = BlackBoxBrake.Emergency; break;
                    }
                }
                else
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeDriver = (BlackBoxBrake)TrainManager.PlayerTrain.Handles.Brake.Driver;
                }
                if (TrainManager.PlayerTrain.Handles.EmergencyBrake.Safety)
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Emergency;
                }
                else if (TrainManager.PlayerTrain.Handles.HoldBrake.Actual)
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.HoldBrake;
                }
                else if (TrainManager.PlayerTrain.Handles.Brake is TrainManager.AirBrakeHandle)
                {
                    switch ((TrainManager.AirBrakeHandleState)TrainManager.PlayerTrain.Handles.Brake.Safety)
                    {
                    case TrainManager.AirBrakeHandleState.Release: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Release; break;

                    case TrainManager.AirBrakeHandleState.Lap: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Lap; break;

                    case TrainManager.AirBrakeHandleState.Service: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Service; break;

                    default: BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = BlackBoxBrake.Emergency; break;
                    }
                }
                else
                {
                    BlackBoxEntries[BlackBoxEntryCount].BrakeSafety = (BlackBoxBrake)TrainManager.PlayerTrain.Handles.Brake.Safety;
                }
                BlackBoxEntries[BlackBoxEntryCount].EventToken = EventToken;
                BlackBoxEntryCount++;
            }
        }