summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-02-04 21:09:29 +0000
committerterkhen <terkhen@openttd.org>2010-02-04 21:09:29 +0000
commit9e03eb08a2126c863ebd464964750264f31dd05e (patch)
tree17a6f381dca6af9c2797e73aafc6cec79f58c0ae /src
parentafe2fe244dea003328d87857bae08d277470d628 (diff)
downloadopenttd-9e03eb08a2126c863ebd464964750264f31dd05e.tar.xz
(svn r19010) -Codechange: Remove a now unneeded check at CmdBuildRailStation.
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index dadbb4859..b92adbd96 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1006,15 +1006,14 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
StationID est = INVALID_STATION;
- /* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
- * for detail info, see:
- * https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 */
- CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL, true, rt);
- if (ret.Failed()) return ret;
- CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len);
+ /* Clear the land below the station. */
+ CommandCost cost = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL, true, rt);
+ if (cost.Failed()) return cost;
+ /* Add construction expenses. */
+ cost.AddCost((numtracks * _price[PR_BUILD_STATION_RAIL] + _price[PR_BUILD_STATION_RAIL_LENGTH]) * plat_len);
Station *st = NULL;
- ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st);
+ CommandCost ret = FindJoiningStation(est, station_to_join, adjacent, new_location, &st);
if (ret.Failed()) return ret;
/* See if there is a deleted station close to us. */
@@ -1076,12 +1075,6 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
byte numtracks_orig;
Track track;
- /* Now really clear the land below the station
- * It should never return CMD_ERROR.. but you never know ;)
- * (a bit strange function name for it, but it really does clear the land, when DC_EXEC is in flags) */
- ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL, true, rt);
- if (ret.Failed()) return ret;
-
st->train_station = new_location;
st->AddFacility(FACIL_TRAIN, new_location.tile);