Fix not being allowed to build docks, ship depots, when removing water is disabled
This commit is contained in:
@@ -2628,7 +2628,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|||||||
/* Get the water class of the water tile before it is cleared.*/
|
/* Get the water class of the water tile before it is cleared.*/
|
||||||
WaterClass wc = GetWaterClass(flat_tile);
|
WaterClass wc = GetWaterClass(flat_tile);
|
||||||
|
|
||||||
ret = DoCommand(flat_tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
ret = DoCommand(flat_tile, 0, 0, flags | DC_ALLOW_REMOVE_WATER, CMD_LANDSCAPE_CLEAR);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
||||||
TileIndex adjacent_tile = flat_tile + TileOffsByDiagDir(direction);
|
TileIndex adjacent_tile = flat_tile + TileOffsByDiagDir(direction);
|
||||||
|
@@ -123,13 +123,13 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui
|
|||||||
CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]);
|
CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_DEPOT_SHIP]);
|
||||||
|
|
||||||
bool add_cost = !IsWaterTile(tile);
|
bool add_cost = !IsWaterTile(tile);
|
||||||
CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
|
CommandCost ret = DoCommand(tile, 0, 0, flags | DC_AUTO | DC_ALLOW_REMOVE_WATER, CMD_LANDSCAPE_CLEAR);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
if (add_cost) {
|
if (add_cost) {
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
}
|
}
|
||||||
add_cost = !IsWaterTile(tile2);
|
add_cost = !IsWaterTile(tile2);
|
||||||
ret = DoCommand(tile2, 0, 0, flags | DC_AUTO, CMD_LANDSCAPE_CLEAR);
|
ret = DoCommand(tile2, 0, 0, flags | DC_AUTO | DC_ALLOW_REMOVE_WATER, CMD_LANDSCAPE_CLEAR);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
if (add_cost) {
|
if (add_cost) {
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
@@ -476,7 +476,10 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags)
|
|||||||
case WATER_TILE_CLEAR: {
|
case WATER_TILE_CLEAR: {
|
||||||
if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
if (flags & DC_NO_WATER) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
|
||||||
if (!IsCanal(tile) && _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);
|
if (!IsCanal(tile) && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)
|
||||||
|
&& _current_company != OWNER_WATER) {
|
||||||
|
return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||||
|
}
|
||||||
|
|
||||||
Money base_cost = IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER];
|
Money base_cost = IsCanal(tile) ? _price[PR_CLEAR_CANAL] : _price[PR_CLEAR_WATER];
|
||||||
/* Make sure freeform edges are allowed or it's not an edge tile. */
|
/* Make sure freeform edges are allowed or it's not an edge tile. */
|
||||||
|
Reference in New Issue
Block a user