Changeset - r22242:8917c4802019
[Not reviewed]
master
0 1 0
frosch - 9 years ago 2015-10-30 17:19:01
frosch@openttd.org
(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.
1 file changed with 29 insertions and 26 deletions:
0 comments (0 inline, 0 general)
src/road.cpp
Show inline comments
 
@@ -57,41 +57,44 @@ RoadBits CleanUpRoadBits(const TileIndex
 
			bool connective = false;
 
			const RoadBits mirrored_rb = MirrorRoadBits(target_rb);
 

	
 
			switch (GetTileType(neighbor_tile)) {
 
				/* Always connective ones */
 
				case MP_CLEAR: case MP_TREES:
 
					connective = true;
 
					break;
 
			if (IsValidTile(neighbor_tile)) {
 
				switch (GetTileType(neighbor_tile)) {
 
					/* Always connective ones */
 
					case MP_CLEAR: case MP_TREES:
 
						connective = true;
 
						break;
 

	
 
				/* The conditionally connective ones */
 
				case MP_TUNNELBRIDGE:
 
				case MP_STATION:
 
				case MP_ROAD: {
 
					const RoadBits neighbor_rb = GetAnyRoadBits(neighbor_tile, ROADTYPE_ROAD) | GetAnyRoadBits(neighbor_tile, ROADTYPE_TRAM);
 
					/* The conditionally connective ones */
 
					case MP_TUNNELBRIDGE:
 
					case MP_STATION:
 
					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);
 

	
 
					/* Accept only connective tiles */
 
					connective = (neighbor_rb & mirrored_rb) || // Neighbor has got the fitting RoadBit
 
							HasExactlyOneBit(neighbor_rb); // Neighbor has got only one Roadbit
 
							/* Accept only connective tiles */
 
							connective = (neighbor_rb & mirrored_rb) != ROAD_NONE;
 
						}
 
						break;
 

	
 
					break;
 
				}
 
					case MP_RAILWAY:
 
						connective = IsPossibleCrossing(neighbor_tile, DiagDirToAxis(dir));
 
						break;
 

	
 
				case MP_RAILWAY:
 
					connective = IsPossibleCrossing(neighbor_tile, DiagDirToAxis(dir));
 
					break;
 
					case MP_WATER:
 
						/* Check for real water tile */
 
						connective = !IsWater(neighbor_tile);
 
						break;
 

	
 
				case MP_WATER:
 
					/* Check for real water tile */
 
					connective = !IsWater(neighbor_tile);
 
					break;
 

	
 
				/* The definitely not connective ones */
 
				default: break;
 
					/* The definitely not connective ones */
 
					default: break;
 
				}
 
			}
 

	
 
			/* If the neighbor tile is inconnective, remove the planed road connection to it */
 
			if (!connective) org_rb ^= target_rb;
 

	
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)