diff options
author | rubidium <rubidium@openttd.org> | 2008-08-02 22:50:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-08-02 22:50:04 +0000 |
commit | 64a576b854a62648551fdf318db00dfbfc4369f5 (patch) | |
tree | 11d7b44f0edd4fca4601a776cb3778dc507c2d52 /src | |
parent | aac73d2a0479d7791dd5b43c17a2b0be406463cd (diff) | |
download | openttd-64a576b854a62648551fdf318db00dfbfc4369f5.tar.xz |
(svn r13937) -Codechange [YAPP]: Don't cycle through two-sided PBS signals during build. (michi_cc)
Diffstat (limited to 'src')
-rw-r--r-- | src/rail_cmd.cpp | 6 | ||||
-rw-r--r-- | src/rail_map.h | 2 |
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); } |