summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-31 20:03:50 +0000
committerrubidium <rubidium@openttd.org>2007-08-31 20:03:50 +0000
commit8c85125fd9c06d1470f02e807bf359329338f97b (patch)
tree415396983bfb3bebc07546a999219c6403a98422 /src/water_cmd.cpp
parenta8033758e7bcae1f48ea3575385c3cfcd1c10213 (diff)
downloadopenttd-8c85125fd9c06d1470f02e807bf359329338f97b.tar.xz
(svn r11024) -Fix [FS#1173]: give a more correct error when building some things on tile 0; "Can't build on water" or "Too close to the edge" instead of "Vehicle in the way". Patch by SmatZ.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 4a069840f..c0f620cbf 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -67,12 +67,9 @@ CommandCost CmdBuildShipDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
- if (!EnsureNoVehicle(tile)) return CMD_ERROR;
-
Axis axis = Extract<Axis, 0>(p1);
tile2 = tile + (axis == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
- if (!EnsureNoVehicle(tile2)) return CMD_ERROR;
if (!IsClearWaterTile(tile) || !IsClearWaterTile(tile2))
return_cmd_error(STR_3801_MUST_BE_BUILT_ON_WATER);
@@ -289,15 +286,15 @@ static CommandCost ClearTile_Water(TileIndex tile, byte flags)
case WATER_TILE_CLEAR:
if (flags & DC_NO_WATER) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER);
- /* Make sure no vehicle is on the tile */
- if (!EnsureNoVehicle(tile)) return CMD_ERROR;
-
/* Make sure it's not an edge tile. */
if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
!IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
}
+ /* Make sure no vehicle is on the tile */
+ if (!EnsureNoVehicle(tile)) return CMD_ERROR;
+
if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR;
if (flags & DC_EXEC) DoClearSquare(tile);
@@ -309,12 +306,6 @@ static CommandCost ClearTile_Water(TileIndex tile, byte flags)
/* Make sure no vehicle is on the tile */
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
- /* Make sure it's not an edge tile. */
- if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
- !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
- return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
- }
-
if (flags & DC_EXEC) DoClearSquare(tile);
if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) {
return CommandCost(_price.clear_water);