59 |
59 |
60 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
60 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
61 |
61 |
62 if (p1 > 1) return CMD_ERROR; |
62 if (p1 > 1) return CMD_ERROR; |
63 |
63 |
64 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
|
65 |
|
66 tile2 = tile + (p1 ? TileDiffXY(0, 1) : TileDiffXY(1, 0)); |
64 tile2 = tile + (p1 ? TileDiffXY(0, 1) : TileDiffXY(1, 0)); |
67 if (!EnsureNoVehicle(tile2)) return CMD_ERROR; |
|
68 |
65 |
69 if (!IsClearWaterTile(tile) || !IsClearWaterTile(tile2)) |
66 if (!IsClearWaterTile(tile) || !IsClearWaterTile(tile2)) |
70 return_cmd_error(STR_3801_MUST_BE_BUILT_ON_WATER); |
67 return_cmd_error(STR_3801_MUST_BE_BUILT_ON_WATER); |
71 |
68 |
72 ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
69 ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); |
292 { |
289 { |
293 switch (GetWaterTileType(tile)) { |
290 switch (GetWaterTileType(tile)) { |
294 case WATER_CLEAR: |
291 case WATER_CLEAR: |
295 if (flags & DC_NO_WATER) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
292 if (flags & DC_NO_WATER) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER); |
296 |
293 |
297 // Make sure no vehicle is on the tile |
|
298 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
|
299 |
|
300 // Make sure it's not an edge tile. |
294 // Make sure it's not an edge tile. |
301 if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) || |
295 if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) || |
302 !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) { |
296 !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) { |
303 return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP); |
297 return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP); |
304 } |
298 } |
305 |
299 |
|
300 /* Make sure no vehicle is on the tile */ |
|
301 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
|
302 |
306 if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR; |
303 if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR; |
307 |
304 |
308 if (flags & DC_EXEC) DoClearSquare(tile); |
305 if (flags & DC_EXEC) DoClearSquare(tile); |
309 return _price.clear_water; |
306 return _price.clear_water; |
310 |
307 |
311 case WATER_COAST: { |
308 case WATER_COAST: { |
312 Slope slope = GetTileSlope(tile, NULL); |
309 Slope slope = GetTileSlope(tile, NULL); |
313 |
310 |
314 // Make sure no vehicle is on the tile |
311 // Make sure no vehicle is on the tile |
315 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
312 if (!EnsureNoVehicle(tile)) return CMD_ERROR; |
316 |
|
317 // Make sure it's not an edge tile. |
|
318 if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) || |
|
319 !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) { |
|
320 return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP); |
|
321 } |
|
322 |
313 |
323 if (flags & DC_EXEC) DoClearSquare(tile); |
314 if (flags & DC_EXEC) DoClearSquare(tile); |
324 if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) { |
315 if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) { |
325 return _price.clear_water; |
316 return _price.clear_water; |
326 } else { |
317 } else { |