From ebb673c4d5d03d0827771d0f8474cc7b13f25c75 Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Thu, 26 Dec 2024 00:36:28 +0100 Subject: [PATCH 1/2] Config: Resolve ATC conflict --- src/Managers/ConfigManager.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Managers/ConfigManager.cs b/src/Managers/ConfigManager.cs index 1f13eb2..eae5311 100644 --- a/src/Managers/ConfigManager.cs +++ b/src/Managers/ConfigManager.cs @@ -175,7 +175,10 @@ namespace OpenbveFcmbTrainPlugin switch (Key) { case "enabled": - PluginSettings.AtcBombardierDeviceEnabled = string.Compare(Value, "false", StringComparison.OrdinalIgnoreCase) != 0; + if (!PluginSettings.AtcDimetronicDeviceEnabled) + { + PluginSettings.AtcBombardierDeviceEnabled = string.Compare(Value, "false", StringComparison.OrdinalIgnoreCase) != 0; + } break; case "initializationtime": { @@ -215,7 +218,10 @@ namespace OpenbveFcmbTrainPlugin switch (Key) { case "enabled": - PluginSettings.AtcDimetronicDeviceEnabled = string.Compare(Value, "false", StringComparison.OrdinalIgnoreCase) != 0; + if (!PluginSettings.AtcBombardierDeviceEnabled) + { + PluginSettings.AtcDimetronicDeviceEnabled = string.Compare(Value, "false", StringComparison.OrdinalIgnoreCase) != 0; + } break; case "yardspeedlimit": { From a836a0e43874ef30c56832bd411526d9ec4f518f Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Thu, 26 Dec 2024 00:36:56 +0100 Subject: [PATCH 2/2] Panel variable indices --- src/Devices/AtcDimetronic.cs | 13 ++++++------- src/Devices/DoorSelection.cs | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Devices/AtcDimetronic.cs b/src/Devices/AtcDimetronic.cs index eff70bc..dfd2dd8 100644 --- a/src/Devices/AtcDimetronic.cs +++ b/src/Devices/AtcDimetronic.cs @@ -346,13 +346,12 @@ namespace OpenbveFcmbTrainPlugin } // Panel indicators - train.Panel[25] = DeviceState == DeviceStates.Override ? 1 : 0; - train.Panel[26] = DeviceState == DeviceStates.YARD ? 1 : 0; - train.Panel[27] = DeviceState == DeviceStates.ATP ? 1 : 0; - train.Panel[28] = DeviceState == DeviceStates.ATO ? 1 : 0; - train.Panel[34] = (int)CurrentSpeedCode.CurrentLimit.KilometersPerHour * 1000; - train.Panel[33] = 1; - train.Panel[35] = (int)CurrentSpeedCode.TargetLimit.KilometersPerHour * 1000; + train.Panel[11] = TrackState > TrackStates.Unprotected && train.PhysicalHandles.Reverser == 1 ? 1 : 0; + train.Panel[12] = AtcControlState == AtcControlStates.NoPower || AtcControlState == AtcControlStates.NoPowerAlarm ? 1 : 0; + train.Panel[13] = (int)DeviceState; + train.Panel[14] = (int)CurrentSpeedCode.CurrentLimit.KilometersPerHour * 1000; + train.Panel[15] = (int)CurrentSpeedCode.TargetLimit.KilometersPerHour * 1000; + train.Panel[16] = (int)DeviceState > 1 ? 1 : 0; // Play alarm sound if (AtcControlState == AtcControlStates.NoPowerAlarm) diff --git a/src/Devices/DoorSelection.cs b/src/Devices/DoorSelection.cs index 2249f25..151129b 100644 --- a/src/Devices/DoorSelection.cs +++ b/src/Devices/DoorSelection.cs @@ -39,8 +39,8 @@ namespace OpenbveFcmbTrainPlugin } // Update panel variables for door selection state - train.Panel[50] = (RequestedDoorInterlock == DoorInterlockStates.Left || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Left) != 0) && !LeftDoorsClosing) ? 1 : 0; - train.Panel[51] = (RequestedDoorInterlock == DoorInterlockStates.Right || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Right) != 0) && !RightDoorsClosing) ? 1 : 0; + train.Panel[1] = (RequestedDoorInterlock == DoorInterlockStates.Left || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Left) != 0) && !LeftDoorsClosing) ? 1 : 0; + train.Panel[2] = (RequestedDoorInterlock == DoorInterlockStates.Right || RequestedDoorInterlock == DoorInterlockStates.Unlocked) || (((train.DoorState & DoorStates.Right) != 0) && !RightDoorsClosing) ? 1 : 0; } /// Is called when the state of a key changes.