From 1e9433e0fff9b53b4578d1065b7592d2ad8e19e0 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 31 Jan 2016 20:56:11 +0000 Subject: [PATCH] progsig: Fix signal dependency being left dangling after cycling side. If the target of a programmable signal dependency was cycled to the other side, the dependency was not cleared. As the dependency was then no longer valid, it was not cleared by the programmable signal. Deleting the programmable signal and then the target signal resulted in a crash. --- src/rail_cmd.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index ec8f5a6b98..dd96c9dc55 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1120,6 +1120,8 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, SetPresentSignals(tile, (GetPresentSignals(tile) & ~SignalOnTrack(track)) | KillFirstBit(SignalOnTrack(track))); } } else { + /* programmable signal dependencies are invalidated when the signal direction is changed */ + CheckRemoveSignal(tile, track); /* cycle the signal side: both -> left -> right -> both -> ... */ CycleSignalSide(tile, track); /* Query current signal type so the check for PBS signals below works. */