mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
Fix: Depot building cost does not include foundation build cost (#6875)
This commit is contained in:
parent
b653c55d34
commit
bdf155e60c
@ -1086,6 +1086,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
|
||||
@ -1093,14 +1095,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)
|
||||
)) {
|
||||
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);
|
||||
|
@ -1141,15 +1141,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)
|
||||
)) {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user