Index: src/town_cmd.cpp
===================================================================
--- src/town_cmd.cpp (revision 27632)
+++ src/town_cmd.cpp (working copy)
@@ -871,6 +871,9 @@
/* Prevent towns from building roads under bridges along the bridge. Looks silly. */
if (IsBridgeAbove(tile) && GetBridgeAxis(tile) == DiagDirToAxis(dir)) return false;
+ /* Prevent towns from building roads where ships can traverse */
+ if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return false;
+
/* Check if there already is a road at this point? */
if (GetTownRoadBits(tile) == ROAD_NONE) {
/* No, try if we are able to build a road piece there.
@@ -1103,6 +1106,9 @@
/* no water tiles in between? */
if (bridge_length == 1) return false;
+ /* Don't build the bridge if the bridge head at the destination is traversable by ships */
+ if ((TrackStatusToTrackBits(GetTileTrackStatus(bridge_tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return false;
+
for (uint8 times = 0; times <= 22; times++) {
byte bridge_type = RandomRange(MAX_BRIDGES - 1);
@@ -1158,6 +1164,7 @@
case TL_3X3_GRID:
case TL_2X2_GRID:
+ if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return;
rcmd = GetTownRoadGridElement(t1, tile, target_dir);
if (rcmd == ROAD_NONE) return;
break;
@@ -2066,7 +2073,7 @@
{
/* cannot build on these slopes... */
Slope slope = GetTileSlope(tile);
- if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false;
+ if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope) || ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE)) return false;
/* building under a bridge? */
if (IsBridgeAbove(tile)) return false;