| Old revision #p9jfcdsya | New revision #pywkih1li | ||
|---|---|---|---|
| 2 | =================================================================== | 2 | =================================================================== |
| 3 | --- src/town_cmd.cpp (revision 27632) | 3 | --- src/town_cmd.cpp (revision 27632) |
| 4 | +++ src/town_cmd.cpp (working copy) | 4 | +++ src/town_cmd.cpp (working copy) |
| 5 | @@ - | 5 | @@ -871,6 +871,9 @@ |
| 6 | | 6 | /* Prevent towns from building roads under bridges along the bridge. Looks silly. */ |
| 7 | | 7 | if (IsBridgeAbove(tile) && GetBridgeAxis(tile) == DiagDirToAxis(dir)) return false; |
| 8 | | 8 | |
| 9 | + /* | 9 | + /* Prevent towns from building roads where ships can traverse */ |
| 10 | + if ( | 10 | + if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return false; |
| 11 | + | 11 | + |
| 12 | if (DoCommand(tile, rcmd, t->index, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD).Succeeded()) { | 12 | /* Check if there already is a road at this point? */ |
| 13 | _grow_town_result = GROWTH_SUCCEED; | 13 | if (GetTownRoadBits(tile) == ROAD_NONE) { |
| 14 | return true; | 14 | /* No, try if we are able to build a road piece there. |
| 15 | @@ -1066,6 +1069,8 @@ | 15 | @@ -1103,6 +1106,9 @@ |
| 16 | assert(bridge_dir < DIAGDIR_END); | ||
| 17 | |||
| 18 | const Slope slope = GetTileSlope(tile); | ||
| 19 | + /* don't build a bridge if the source tile is a coast with only one corner raised */ | ||
| 20 | + if (IsSlopeWithOneCornerRaised(slope) && IsCoastTile(tile)) return false; | ||
| 21 | |||
| 22 | /* Make sure the direction is compatible with the slope. | ||
| 23 | * Well we check if the slope has an up bit set in the | ||
| 24 | @@ -1103,6 +1108,9 @@ | ||
| 25 | /* no water tiles in between? */ | 16 | /* no water tiles in between? */ |
| 26 | if (bridge_length == 1) return false; | 17 | if (bridge_length == 1) return false; |
| 27 | 18 | ||
| 28 | + /* | 28 | + /* Don't build the bridge if the bridge head at the destination is traversable by ships */ |
| 29 | + if ( | 29 | + if ((TrackStatusToTrackBits(GetTileTrackStatus(bridge_tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return false; |
| 30 | + | 21 | + |
| 31 | for (uint8 times = 0; times <= 22; times++) { | 22 | for (uint8 times = 0; times <= 22; times++) { |
| 32 | byte bridge_type = RandomRange(MAX_BRIDGES - 1); | 23 | byte bridge_type = RandomRange(MAX_BRIDGES - 1); |
| 33 | 24 | ||
| 34 | @@ -2066,7 +2074,7 @@ | 25 | @@ -1158,6 +1164,7 @@ |
| 26 | |||
| 27 | case TL_3X3_GRID: | ||
| 28 | case TL_2X2_GRID: | ||
| 29 | + if ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE) return; | ||
| 30 | rcmd = GetTownRoadGridElement(t1, tile, target_dir); | ||
| 31 | if (rcmd == ROAD_NONE) return; | ||
| 32 | break; | ||
| 33 | @@ -2066,7 +2073,7 @@ | ||
| 35 | { | 34 | { |
| 36 | /* cannot build on these slopes... */ | 35 | /* cannot build on these slopes... */ |
| 37 | Slope slope = GetTileSlope(tile); | 36 | Slope slope = GetTileSlope(tile); |
| 38 | - if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false; | 37 | - if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false; |
| 39 | + if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope) || ( | 39 | + if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope) || ((TrackStatusToTrackBits(GetTileTrackStatus(tile, TRANSPORT_WATER, 0)) & TRACK_BIT_ALL) != TRACK_BIT_NONE)) return false; |
| 40 | 39 | ||
| 41 | /* building under a bridge? */ | 40 | /* building under a bridge? */ |
| 42 | if (IsBridgeAbove(tile)) return false; | 41 | if (IsBridgeAbove(tile)) return false; |