summaryrefslogtreecommitdiff
path: root/src/rail_cmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rail_cmd.cpp')
-rw-r--r--src/rail_cmd.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index d21c1468c..d5194e0c3 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -967,6 +967,8 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
DiagDirection dir = Extract<DiagDirection, 0, 2>(p2);
+ CommandCost cost(EXPENSES_CONSTRUCTION);
+
/* Prohibit construction if
* The tile is non-flat AND
* 1) build-on-slopes is disabled
@@ -974,14 +976,14 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u
* 3) the exit points in the wrong direction
*/
- if (tileh != SLOPE_FLAT && (
- !_settings_game.construction.build_on_slopes ||
- !CanBuildDepotByTileh(dir, tileh)
- )) {
- return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
+ if (tileh != SLOPE_FLAT) {
+ if (!_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh)) {
+ return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED);
+ }
+ cost.AddCost(_price[PR_BUILD_FOUNDATION]);
}
- CommandCost cost = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ cost.AddCost(DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR));
if (cost.Failed()) return cost;
if (IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST);