1
0
Fork 0

(svn r27424) -Fix [FS#6374]: Towns did not connect roads to existing roads, unless they had only a single roadbit. Otoh, towns also tried to connect to single roadbit tiles such as tunnels and depots, even though they were not connectable in the direction of interest.

release/1.6
frosch 2015-10-30 17:19:01 +00:00
parent ab7ebdcfd9
commit c0a301ae60
1 changed files with 30 additions and 27 deletions

View File

@ -57,6 +57,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
bool connective = false; bool connective = false;
const RoadBits mirrored_rb = MirrorRoadBits(target_rb); const RoadBits mirrored_rb = MirrorRoadBits(target_rb);
if (IsValidTile(neighbor_tile)) {
switch (GetTileType(neighbor_tile)) { switch (GetTileType(neighbor_tile)) {
/* Always connective ones */ /* Always connective ones */
case MP_CLEAR: case MP_TREES: case MP_CLEAR: case MP_TREES:
@ -66,15 +67,17 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
/* The conditionally connective ones */ /* The conditionally connective ones */
case MP_TUNNELBRIDGE: case MP_TUNNELBRIDGE:
case MP_STATION: case MP_STATION:
case MP_ROAD: { case MP_ROAD:
if (IsNormalRoadTile(neighbor_tile)) {
/* Always connective */
connective = true;
} else {
const RoadBits neighbor_rb = GetAnyRoadBits(neighbor_tile, ROADTYPE_ROAD) | GetAnyRoadBits(neighbor_tile, ROADTYPE_TRAM); const RoadBits neighbor_rb = GetAnyRoadBits(neighbor_tile, ROADTYPE_ROAD) | GetAnyRoadBits(neighbor_tile, ROADTYPE_TRAM);
/* Accept only connective tiles */ /* Accept only connective tiles */
connective = (neighbor_rb & mirrored_rb) || // Neighbor has got the fitting RoadBit connective = (neighbor_rb & mirrored_rb) != ROAD_NONE;
HasExactlyOneBit(neighbor_rb); // Neighbor has got only one Roadbit
break;
} }
break;
case MP_RAILWAY: case MP_RAILWAY:
connective = IsPossibleCrossing(neighbor_tile, DiagDirToAxis(dir)); connective = IsPossibleCrossing(neighbor_tile, DiagDirToAxis(dir));
@ -88,10 +91,10 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
/* The definitely not connective ones */ /* The definitely not connective ones */
default: break; default: break;
} }
}
/* If the neighbor tile is inconnective, remove the planed road connection to it */ /* If the neighbor tile is inconnective, remove the planed road connection to it */
if (!connective) org_rb ^= target_rb; if (!connective) org_rb ^= target_rb;
} }
} }