summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-02-24 19:15:23 +0000
committeryexo <yexo@openttd.org>2009-02-24 19:15:23 +0000
commit8beca127ddf8f97b76c4bd3491ead1f6954b115d (patch)
treeb98f5de8b180354cedf9e59e385691e9a4d38d9c /src
parent8fa247c4b15a70e0d03e8af10fa6ef5d59e0793e (diff)
downloadopenttd-8beca127ddf8f97b76c4bd3491ead1f6954b115d.tar.xz
(svn r15567) -Fix [FS#2674]: When building signals by dragging from a pre/entry/combo block signal, the signal you started at became a normal block signal.
Diffstat (limited to 'src')
-rw-r--r--src/rail_cmd.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index e76fea8aa..13955b8b6 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -807,6 +807,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
* - p1 = (bit 9-11)- start cycle from this signal type
* - p1 = (bit 12-14)-wrap around after this signal type
* - p1 = (bit 15-16)-cycle the signal direction this many times
+ * - p1 = (bit 17) - 1 = don't modify an existing signal but don't fail either, 0 = always set new signal type
* @param p2 used for CmdBuildManySignals() to copy direction of first signal
* TODO: p2 should be replaced by two bits for "along" and "against" the track.
*/
@@ -845,6 +846,9 @@ CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1,
}
}
+ /* In case we don't want to change an existing signal, return without error. */
+ if (HasBit(p1, 17) && HasSignalOnTrack(tile, track)) return CommandCost();
+
/* you can not convert a signal if no signal is on track */
if (convert_signal && !HasSignalOnTrack(tile, track)) return CMD_ERROR;
@@ -1095,6 +1099,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
SB(p1, 3, 1, mode);
SB(p1, 4, 1, semaphores);
SB(p1, 5, 3, sigtype);
+ if (!remove && signal_ctr == 0) SetBit(p1, 17);
/* Pick the correct orientation for the track direction */
signals = 0;