summaryrefslogtreecommitdiff
path: root/rail_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-11-05 18:21:28 +0000
committerpeter1138 <peter1138@openttd.org>2005-11-05 18:21:28 +0000
commit4c6a67a723cfc110fef7f29dc098c27a9e9c8695 (patch)
treeafc5af7f6d66658a2146b81d502577b2c84d23c3 /rail_cmd.c
parent1ad139c9e0373613ce4c9968b9205c089725de1a (diff)
downloadopenttd-4c6a67a723cfc110fef7f29dc098c27a9e9c8695.tar.xz
(svn r3141) Replace incorrect railtype bitmask in CmdRailTrackHelper with appropriate GB()
Diffstat (limited to 'rail_cmd.c')
-rw-r--r--rail_cmd.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 2814b23b4..c6e49a8fc 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -587,8 +587,9 @@ static int32 CmdRailTrackHelper(int x, int y, uint32 flags, uint32 p1, uint32 p2
Track track = (Track)GB(p2, 4, 3);
Trackdir trackdir;
byte mode = HASBIT(p2, 7);
+ RailType railtype = (RailType)GB(p2, 0, 4);
- if (!ValParamRailtype(p2 & 0x3) || !ValParamTrackOrientation(track)) return CMD_ERROR;
+ if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
if (p1 > MapSize()) return CMD_ERROR;
trackdir = TrackToTrackdir(track);
@@ -603,7 +604,7 @@ static int32 CmdRailTrackHelper(int x, int y, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) SndPlayTileFx(SND_20_SPLAT_2, TileVirtXY(x, y));
for(;;) {
- ret = DoCommand(x, y, p2 & 0x3, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
+ ret = DoCommand(x, y, railtype, TrackdirToTrack(trackdir), flags, (mode == 0) ? CMD_BUILD_SINGLE_RAIL : CMD_REMOVE_SINGLE_RAIL);
if (CmdFailed(ret)) {
if ((_error_message != STR_1007_ALREADY_BUILT) && (mode == 0))