summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-02 22:48:57 +0000
committerrubidium <rubidium@openttd.org>2008-08-02 22:48:57 +0000
commitd6645818b4b29a42dd617c92e23a525fe5170b6a (patch)
tree9b423b584c96b7a05e9686e33d0f76540f794cfd /src/rail_cmd.cpp
parentfe4f23dba23ba7553304961773a74bc1037e12a7 (diff)
downloadopenttd-d6645818b4b29a42dd617c92e23a525fe5170b6a.tar.xz
(svn r13933) -Codechange [YAPP]: Handle through and PBS signals correctly in the signal code. (michi_cc)
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 51ddec70f..4ac7f76ac 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -2181,12 +2181,13 @@ static TrackStatus GetTileTrackStatus_Track(TileIndex tile, TransportType mode,
b &= a;
- /* When signals are not present (in neither
- * direction), we pretend them to be green. (So if
- * signals are only one way, the other way will
- * implicitely become `red' */
- if ((a & 0xC) == 0) b |= 0xC;
- if ((a & 0x3) == 0) b |= 0x3;
+ /* When signals are not present (in neither direction),
+ * we pretend them to be green. Otherwise, it depends on
+ * the signal type. For signals that are only active from
+ * one side, we set the missing signals explicitely to
+ * `green'. Otherwise, they implicitely become `red'. */
+ if (!IsOnewaySignal(tile, TRACK_UPPER) || (a & SignalOnTrack(TRACK_UPPER)) == 0) b |= ~a & SignalOnTrack(TRACK_UPPER);
+ if (!IsOnewaySignal(tile, TRACK_LOWER) || (a & SignalOnTrack(TRACK_LOWER)) == 0) b |= ~a & SignalOnTrack(TRACK_LOWER);
if ((b & 0x8) == 0) red_signals |= (TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_X_NE | TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_UPPER_E);
if ((b & 0x4) == 0) red_signals |= (TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_X_SW | TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_UPPER_W);