82 if (GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT) return GetRailWaypointBits(t); |
82 if (GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT) return GetRailWaypointBits(t); |
83 default: |
83 default: |
84 return 0; |
84 return 0; |
85 } |
85 } |
86 break; |
86 break; |
|
87 |
87 case MP_TUNNELBRIDGE: |
88 case MP_TUNNELBRIDGE: |
88 if (IsTunnel(t)) { |
89 if (IsTunnel(t)) { |
89 if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0; |
90 if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0; |
90 if (override != NULL) *override = 1 << GetTunnelDirection(t); |
91 if (override != NULL) *override = 1 << GetTunnelDirection(t); |
91 return DiagDirToAxis(GetTunnelDirection(t)) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y; |
92 return DiagDirToAxis(GetTunnelDirection(t)) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y; |
102 if (override != NULL && DistanceMax(t, GetOtherBridgeEnd(t)) > 1) *override = 1 << GetBridgeRampDirection(t); |
103 if (override != NULL && DistanceMax(t, GetOtherBridgeEnd(t)) > 1) *override = 1 << GetBridgeRampDirection(t); |
103 |
104 |
104 return DiagDirToAxis(GetBridgeRampDirection(t)) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y; |
105 return DiagDirToAxis(GetBridgeRampDirection(t)) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y; |
105 } |
106 } |
106 } |
107 } |
|
108 |
107 case MP_STREET: |
109 case MP_STREET: |
108 if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return 0; |
110 if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return 0; |
109 if (GetRailTypeCrossing(t) != RAILTYPE_ELECTRIC) return 0; |
111 if (GetRailTypeCrossing(t) != RAILTYPE_ELECTRIC) return 0; |
110 return GetCrossingRailBits(t); |
112 return GetCrossingRailBits(t); |
|
113 |
111 case MP_STATION: |
114 case MP_STATION: |
112 if (!IsRailwayStation(t)) return 0; |
115 if (!IsRailwayStation(t)) return 0; |
113 if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0; |
116 if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0; |
114 if (!IsStationTileElectrifiable(t)) return 0; |
117 if (!IsStationTileElectrifiable(t)) return 0; |
115 return TrackToTrackBits(GetRailStationTrack(t)); |
118 return TrackToTrackBits(GetRailStationTrack(t)); |
|
119 |
116 default: |
120 default: |
117 return 0; |
121 return 0; |
118 } |
122 } |
119 } |
123 } |
120 |
124 |
122 * @param tile The tile to analyse |
126 * @param tile The tile to analyse |
123 * @param *tileh the tileh |
127 * @param *tileh the tileh |
124 */ |
128 */ |
125 static void AdjustTileh(TileIndex tile, Slope* tileh) |
129 static void AdjustTileh(TileIndex tile, Slope* tileh) |
126 { |
130 { |
127 if (IsTunnelTile(tile)) *tileh = SLOPE_FLAT; |
131 if (IsTileType(tile, MP_TUNNELBRIDGE)) { |
128 if (IsBridgeTile(tile) && IsBridgeRamp(tile)) { |
132 if (IsTunnel(tile)) { |
129 if (*tileh != SLOPE_FLAT) { |
|
130 *tileh = SLOPE_FLAT; |
133 *tileh = SLOPE_FLAT; |
131 } else { |
134 } else { |
132 switch (GetBridgeRampDirection(tile)) { |
135 if (IsBridgeRamp(tile)) { |
133 case DIAGDIR_NE: *tileh = SLOPE_NE; break; |
136 if (*tileh != SLOPE_FLAT) { |
134 case DIAGDIR_SE: *tileh = SLOPE_SE; break; |
137 *tileh = SLOPE_FLAT; |
135 case DIAGDIR_SW: *tileh = SLOPE_SW; break; |
138 } else { |
136 case DIAGDIR_NW: *tileh = SLOPE_NW; break; |
139 switch (GetBridgeRampDirection(tile)) { |
137 default: break; |
140 case DIAGDIR_NE: *tileh = SLOPE_NE; break; |
|
141 case DIAGDIR_SE: *tileh = SLOPE_SE; break; |
|
142 case DIAGDIR_SW: *tileh = SLOPE_SW; break; |
|
143 case DIAGDIR_NW: *tileh = SLOPE_NW; break; |
|
144 default: break; |
|
145 } |
|
146 } |
138 } |
147 } |
139 } |
148 } |
140 } |
149 } |
141 } |
150 } |
142 |
151 |
244 |
253 |
245 /* Now decide where we draw our pylons. First try the preferred PPPs, but they may not exist. |
254 /* Now decide where we draw our pylons. First try the preferred PPPs, but they may not exist. |
246 In that case, we try the any of the allowed ones. if they don't exist either, don't draw |
255 In that case, we try the any of the allowed ones. if they don't exist either, don't draw |
247 anything. Note that the preferred PPPs still contain the end-of-line markers. |
256 anything. Note that the preferred PPPs still contain the end-of-line markers. |
248 Remove those (simply by ANDing with allowed, since these markers are never allowed) */ |
257 Remove those (simply by ANDing with allowed, since these markers are never allowed) */ |
249 if ( (PPPallowed[i] & PPPpreferred[i]) != 0) PPPallowed[i] &= PPPpreferred[i]; |
258 if ((PPPallowed[i] & PPPpreferred[i]) != 0) PPPallowed[i] &= PPPpreferred[i]; |
250 |
259 |
251 if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) { |
260 if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) { |
252 for (k = 0; k < DIR_END; k++) { |
261 for (k = 0; k < DIR_END; k++) { |
253 byte temp = PPPorder[i][GetTLG(ti->tile)][k]; |
262 byte temp = PPPorder[i][GetTLG(ti->tile)][k]; |
|
263 |
254 if (HASBIT(PPPallowed[i], temp)) { |
264 if (HASBIT(PPPallowed[i], temp)) { |
255 uint x = ti->x + x_pcp_offsets[i] + x_ppp_offsets[temp]; |
265 uint x = ti->x + x_pcp_offsets[i] + x_ppp_offsets[temp]; |
256 uint y = ti->y + y_pcp_offsets[i] + y_ppp_offsets[temp]; |
266 uint y = ti->y + y_pcp_offsets[i] + y_ppp_offsets[temp]; |
257 |
267 |
258 /* Don't build the pylon if it would be outside the tile */ |
268 /* Don't build the pylon if it would be outside the tile */ |