Fix #6875: Depot building cost does not include foundation build cost (#6883)

This commit is contained in:
Jonathan G Rennison
2018-08-14 21:05:47 +01:00
committed by Michael Lutz
parent d839526365
commit df92a056df
3 changed files with 19 additions and 15 deletions

View File

@@ -1017,15 +1017,17 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
CommandCost cost(EXPENSES_CONSTRUCTION);
Slope tileh = GetTileSlope(tile);
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);