|
|
|
@ -581,7 +581,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
|
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
cost.AddCost(ret);
|
|
|
|
|
|
|
|
|
|
ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
|
|
|
|
ret = DoCommand(tile, 0, 0, flags | DC_ALLOW_REMOVE_WATER, CMD_LANDSCAPE_CLEAR);
|
|
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
cost.AddCost(ret);
|
|
|
|
|
|
|
|
|
@ -2014,6 +2014,8 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
|
|
|
|
|
CommandCost ret = EnsureNoVehicleOnGround(tile);
|
|
|
|
|
if (ret.Failed()) return ret;
|
|
|
|
|
|
|
|
|
|
if (_game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
|
|
|
|
|
|
|
|
|
/* The track was removed, and left a coast tile. Now also clear the water. */
|
|
|
|
|
if (flags & DC_EXEC) DoClearSquare(tile);
|
|
|
|
|
cost.AddCost(_price[PR_CLEAR_WATER]);
|
|
|
|
@ -3239,7 +3241,10 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old
|
|
|
|
|
/* Make the ground dirty, if surface slope has changed */
|
|
|
|
|
if (tileh_old != tileh_new) {
|
|
|
|
|
/* If there is flat water on the lower halftile add the cost for clearing it */
|
|
|
|
|
if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old)) cost.AddCost(_price[PR_CLEAR_WATER]);
|
|
|
|
|
if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old)) {
|
|
|
|
|
if (_game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
|
|
|
|
cost.AddCost(_price[PR_CLEAR_WATER]);
|
|
|
|
|
}
|
|
|
|
|
if ((flags & DC_EXEC) != 0) SetRailGroundType(tile, RAIL_GROUND_BARREN);
|
|
|
|
|
}
|
|
|
|
|
return cost;
|
|
|
|
@ -3265,6 +3270,8 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int
|
|
|
|
|
/* Allow clearing the water only if there is no ship */
|
|
|
|
|
if (was_water && HasVehicleOnPos(tile, NULL, &EnsureNoShipProc)) return_cmd_error(STR_ERROR_SHIP_IN_THE_WAY);
|
|
|
|
|
|
|
|
|
|
if (was_water && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
|
|
|
|
|
|
|
|
|
/* First test autoslope. However if it succeeds we still have to test the rest, because non-autoslope terraforming is cheaper. */
|
|
|
|
|
CommandCost autoslope_result = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, rail_bits);
|
|
|
|
|
|
|
|
|
|