equal
deleted
inserted
replaced
235 if (!PathFinderInfo->rail_or_road && IsRoad(atile)) { |
235 if (!PathFinderInfo->rail_or_road && IsRoad(atile)) { |
236 if (IsTileType(atile, MP_TUNNELBRIDGE)) { |
236 if (IsTileType(atile, MP_TUNNELBRIDGE)) { |
237 if (IsTunnel(atile)) { |
237 if (IsTunnel(atile)) { |
238 if (GetTunnelDirection(atile) != i) continue; |
238 if (GetTunnelDirection(atile) != i) continue; |
239 } else { |
239 } else { |
240 if ((_m[atile].m5 & 1) != DiagDirToAxis(i)) continue; |
240 if (GetBridgeRampDirection(atile) != i) continue; |
241 } |
241 } |
242 } |
|
243 } |
|
244 // But also if we are on a bridge, we can only move a certain direction |
|
245 if (!PathFinderInfo->rail_or_road && IsRoad(ctile)) { |
|
246 if (IsTileType(ctile, MP_TUNNELBRIDGE)) { |
|
247 // An existing bridge/tunnel... let's test the direction ;) |
|
248 if ((_m[ctile].m5 & 1) != (i & 1)) continue; |
|
249 } |
242 } |
250 } |
243 } |
251 |
244 |
252 if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 || |
245 if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 || |
253 (AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) { |
246 (AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) { |
289 if (IsTileType(ctile, MP_TUNNELBRIDGE)) { |
282 if (IsTileType(ctile, MP_TUNNELBRIDGE)) { |
290 // We have a bridge, how nicely! We should mark it... |
283 // We have a bridge, how nicely! We should mark it... |
291 dir = 0; |
284 dir = 0; |
292 } else { |
285 } else { |
293 // It already has road.. check if we miss any bits! |
286 // It already has road.. check if we miss any bits! |
294 if ((_m[ctile].m5 & dir) != dir) { |
287 if ((GetAnyRoadBits(ctile, ROADTYPE_ROAD) & dir) != dir) { |
295 // We do miss some pieces :( |
288 // We do miss some pieces :( |
296 dir &= ~_m[ctile].m5; |
289 dir &= ~GetAnyRoadBits(ctile, ROADTYPE_ROAD); |
297 } else { |
290 } else { |
298 dir = 0; |
291 dir = 0; |
299 } |
292 } |
300 } |
293 } |
301 } |
294 } |