Index: src/station_cmd.cpp
===================================================================
--- src/station_cmd.cpp (revision 27632)
+++ src/station_cmd.cpp (working copy)
@@ -2504,6 +2504,14 @@
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
}
+ if (HasTileWaterClass(tile_cur)) {
+ TrackBits tb = TrackStatusToTrackBits(GetTileTrackStatus(tile_cur, TRANSPORT_WATER, 0));
+ if (((direction == DIAGDIR_SW && (tb & TRACK_BIT_3WAY_NE) != 0) || (direction == DIAGDIR_NW && (tb & TRACK_BIT_3WAY_SE) != 0) || (direction == DIAGDIR_SE && (tb & TRACK_BIT_3WAY_NW) != 0) || (direction == DIAGDIR_NE && (tb & TRACK_BIT_3WAY_SW) != 0) && !IsShipDepotTile(tile_cur) && IsTileType(tile_cur, MP_WATER) && !IsLock(tile_cur))) {
+ ret = EnsureNoVehicleOnGround(tile_cur);
+ if (ret.Failed()) return ret;
+ }
+ }
+
TileArea dock_area = TileArea(tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction]);
Index: src/water_cmd.cpp
===================================================================
--- src/water_cmd.cpp (revision 27632)
+++ src/water_cmd.cpp (working copy)
@@ -135,6 +135,39 @@
cost.AddCost(ret);
}
+ TrackBits tb;
+ TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, -1) : TileDiffXY(1, 0));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile2 + (axis == AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(-1, 0));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
if (flags & DC_EXEC) {
Depot *depot = new Depot(tile);
depot->build_date = _date;
@@ -372,6 +405,41 @@
DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile));
if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION);
+ Axis axis = DiagDirToAxis(dir);
+ TrackBits tb;
+ CommandCost ret;
+ TileIndex tc = tile + (axis == AXIS_X ? TileDiffXY(-1, -1) : TileDiffXY(1, -1));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile + (axis == AXIS_X ? TileDiffXY(1, -1) : TileDiffXY(1, 1));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_NE) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_SE) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile + (axis == AXIS_X ? TileDiffXY(-1, 1) : TileDiffXY(-1, -1));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
+ tc = tile + (axis == AXIS_X ? TileDiffXY(1, 1) : TileDiffXY(-1, 1));
+ if (HasTileWaterClass(tc)) {
+ tb = TrackStatusToTrackBits(GetTileTrackStatus(tc, TRANSPORT_WATER, 0));
+ if (((axis == AXIS_Y && (tb & TRACK_BIT_3WAY_SW) != 0) || (axis == AXIS_X && (tb & TRACK_BIT_3WAY_NW) != 0) && !IsShipDepotTile(tc) && IsTileType(tc, MP_WATER) && !IsLock(tc))) {
+ ret = EnsureNoVehicleOnGround(tc);
+ if (ret.Failed()) return ret;
+ }
+ }
return DoBuildLock(tile, dir, flags);
}