summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rail_cmd.cpp6
-rw-r--r--src/rail_map.h2
2 files changed, 7 insertions, 1 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index a983857f5..0494d9ddc 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -889,6 +889,9 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32
/* convert the present signal to the chosen type and variant */
SetSignalType(tile, track, sigtype);
SetSignalVariant(tile, track, sigvar);
+ if (IsPbsSignal(sigtype) && (GetPresentSignals(tile) & SignalOnTrack(track)) == SignalOnTrack(track)) {
+ SetPresentSignals(tile, (GetPresentSignals(tile) & ~SignalOnTrack(track)) | KillFirstBit(SignalOnTrack(track)));
+ }
}
} else if (ctrl_pressed) {
@@ -898,6 +901,9 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32
if (sigtype < cycle_start || sigtype > cycle_stop) sigtype = cycle_start;
SetSignalType(tile, track, sigtype);
+ if (IsPbsSignal(sigtype) && (GetPresentSignals(tile) & SignalOnTrack(track)) == SignalOnTrack(track)) {
+ SetPresentSignals(tile, (GetPresentSignals(tile) & ~SignalOnTrack(track)) | KillFirstBit(SignalOnTrack(track)));
+ }
} else {
/* cycle the signal side: both -> left -> right -> both -> ... */
CycleSignalSide(tile, track);
diff --git a/src/rail_map.h b/src/rail_map.h
index 8e47ea5f5..805915718 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -380,7 +380,7 @@ static inline void CycleSignalSide(TileIndex t, Track track)
byte pos = (track == TRACK_LOWER || track == TRACK_RIGHT) ? 4 : 6;
sig = GB(_m[t].m3, pos, 2);
- if (--sig == 0) sig = 3;
+ if (--sig == 0) sig = IsPbsSignal(GetSignalType(t, track)) ? 2 : 3;
SB(_m[t].m3, pos, 2, sig);
}