(svn r2539) * Fix: Mixed up use of trackdirs and directions in GetTileRailType() causes NPF to not consider routes under bridges.

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
matthijs 20 years ago
parent 418e032fac
commit ff0383dace

@ -109,6 +109,7 @@ const Trackdir _reverse_trackdir[] = {
RailType GetTileRailType(TileIndex tile, Trackdir trackdir) RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
{ {
RailType type = INVALID_RAILTYPE; RailType type = INVALID_RAILTYPE;
DiagDirection exitdir = TrackdirToExitdir(trackdir);
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
case MP_RAILWAY: case MP_RAILWAY:
/* railway track */ /* railway track */
@ -129,10 +130,10 @@ RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
/* railway bridge ending */ /* railway bridge ending */
if ((_map5[tile] & 0xC6) == 0x80) type = _map3_lo[tile] & RAILTYPE_MASK; if ((_map5[tile] & 0xC6) == 0x80) type = _map3_lo[tile] & RAILTYPE_MASK;
/* on railway bridge */ /* on railway bridge */
if ((_map5[tile] & 0xC6) == 0xC0 && ((DiagDirection)(_map5[tile] & 0x1)) == (TrackdirToExitdir(trackdir) & 0x1)) if ((_map5[tile] & 0xC6) == 0xC0 && ((DiagDirection)(_map5[tile] & 0x1)) == (exitdir & 0x1))
type = (_map3_lo[tile] >> 4) & RAILTYPE_MASK; type = (_map3_lo[tile] >> 4) & RAILTYPE_MASK;
/* under bridge (any type) */ /* under bridge (any type) */
if ((_map5[tile] & 0xC0) == 0xC0 && ((uint)_map5[tile] & 0x1) != (trackdir & 0x1)) if ((_map5[tile] & 0xC0) == 0xC0 && ((uint)_map5[tile] & 0x1) != (exitdir & 0x1))
type = _map3_lo[tile] & RAILTYPE_MASK; type = _map3_lo[tile] & RAILTYPE_MASK;
break; break;
default: default:

Loading…
Cancel
Save