ATC Bombardier: check track state

main
Marc Riera 2024-11-24 22:09:28 +01:00
parent 594e053860
commit 927ebd567c
1 changed files with 32 additions and 1 deletions

View File

@ -45,6 +45,18 @@ namespace OpenbveFcmbTrainPlugin
/// <summary>The current state of the ATC control.</summary> /// <summary>The current state of the ATC control.</summary>
private AtcControlStates AtcControlState; private AtcControlStates AtcControlState;
/// <summary>Represents the state of the track.</summary>
private enum TrackStates
{
Unprotected,
Enable,
ATC,
Disable
}
/// <summary>The current state of the track.</summary>
private TrackStates TrackState;
/// <summary>The time needed by the ATC device to initialize, in seconds.</summary> /// <summary>The time needed by the ATC device to initialize, in seconds.</summary>
private double InitializationTime; private double InitializationTime;
@ -360,11 +372,30 @@ namespace OpenbveFcmbTrainPlugin
} }
} }
/// <summary>Is called to inform about signals.</summary>
/// <param name="signal">The signal data.</param>
internal override void SetSignal(SignalData[] signal)
{
}
/// <summary>Is called when a beacon is passed.</summary> /// <summary>Is called when a beacon is passed.</summary>
/// <param name="beacon">The beacon data.</param> /// <param name="beacon">The beacon data.</param>
internal override void SetBeacon(BeaconData beacon) internal override void SetBeacon(BeaconData beacon)
{ {
int type = beacon.Type;
switch (type)
{
case -16777215:
{
if (!(beacon.Optional >= 0 & beacon.Optional <= 3))
{
break;
}
TrackState = (TrackStates)beacon.Optional;
return;
}
}
} }
/// <summary>Is called when the device should perform the AI.</summary> /// <summary>Is called when the device should perform the AI.</summary>