summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-26 14:54:34 +0000
committerfrosch <frosch@openttd.org>2014-01-26 14:54:34 +0000
commit5d4c4b9172632fa069592298e2f86a3259ff760c (patch)
tree62244f3234c85d4104cbfac8cc5f2ec84313f369 /src/rail_cmd.cpp
parentcce3d4fec805ae3c55d24a9d05cbc6c1a3aeba99 (diff)
downloadopenttd-5d4c4b9172632fa069592298e2f86a3259ff760c.tar.xz
(svn r26279) -Fix [FS#5853]: [NoAI] Some RemoveRail methods required to set a valid railtype, though it was not used anyway. Remove the need to set one.
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 1b2d64d7f..f471af23d 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -821,7 +821,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
* @param flags operation to perform
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
- * - p2 = (bit 0-3) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
+ * - p2 = (bit 0-3) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 4-6) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* - p2 = (bit 8) - 0 = build up to an obstacle, 1 = fail if an obstacle is found (used for AIs).
@@ -835,7 +835,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
bool remove = HasBit(p2, 7);
RailType railtype = Extract<RailType, 0, 4>(p2);
- if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR;
+ if ((!remove && !ValParamRailtype(railtype)) || !ValParamTrackOrientation(track)) return CMD_ERROR;
if (p1 >= MapSize()) return CMD_ERROR;
TileIndex end_tile = p1;
Trackdir trackdir = TrackToTrackdir(track);
@@ -846,7 +846,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
bool had_success = false;
CommandCost last_error = CMD_ERROR;
for (;;) {
- CommandCost ret = DoCommand(tile, railtype, TrackdirToTrack(trackdir), flags, remove ? CMD_REMOVE_SINGLE_RAIL : CMD_BUILD_SINGLE_RAIL);
+ CommandCost ret = DoCommand(tile, remove ? 0 : railtype, TrackdirToTrack(trackdir), flags, remove ? CMD_REMOVE_SINGLE_RAIL : CMD_BUILD_SINGLE_RAIL);
if (ret.Failed()) {
last_error = ret;
@@ -900,7 +900,7 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1
* @param flags operation to perform
* @param p1 end tile of drag
* @param p2 various bitstuffed elements
- * - p2 = (bit 0-3) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev)
+ * - p2 = (bit 0-3) - railroad type normal/maglev (0 = normal, 1 = mono, 2 = maglev), only used for building
* - p2 = (bit 4-6) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @param text unused