diff options
author | smatz <smatz@openttd.org> | 2008-01-23 20:02:30 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-01-23 20:02:30 +0000 |
commit | b5641ae0f2ca3723af7fe7f68c4ac45e113e8421 (patch) | |
tree | 7c597878ff045b8f176d053332cb0371866f6767 /src | |
parent | e40944f8e0f7666d27f106d2f5b5be7e86d1814e (diff) | |
download | openttd-b5641ae0f2ca3723af7fe7f68c4ac45e113e8421.tar.xz |
(svn r11967) -Fix (r1400): MP_ROAD can have railbits too - OPF searching over rail of diffent owner behind crossing
Diffstat (limited to 'src')
-rw-r--r-- | src/pathfind.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/pathfind.cpp b/src/pathfind.cpp index 88700cfc3..5b1d1b69f 100644 --- a/src/pathfind.cpp +++ b/src/pathfind.cpp @@ -277,13 +277,6 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi /* can we enter tile in this dir? */ if (!CanAccessTileInDir(tile, ReverseDiagDir(direction), tpf->tracktype)) return; - /* Check in case of rail if the owner is the same */ - if (tpf->tracktype == TRANSPORT_RAIL) { - if (IsTileType(tile_org, MP_RAILWAY) || IsTileType(tile_org, MP_STATION) || IsTileType(tile_org, MP_TUNNELBRIDGE)) - if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE)) - if (GetTileOwner(tile_org) != GetTileOwner(tile)) return; - } - /* Check if the new tile is a tunnel or bridge head and that the direction * and transport type match */ if (IsTileType(tile, MP_TUNNELBRIDGE)) { @@ -293,9 +286,16 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi } } - tpf->rd.cur_length++; + uint32 bits = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type); - uint bits = GetTileTrackStatus(tile, tpf->tracktype, tpf->sub_type); + /* Check in case of rail if the owner is the same */ + if (tpf->tracktype == TRANSPORT_RAIL) { + if (bits != 0 && GetTileTrackStatus(tile_org, TRANSPORT_RAIL, 0) != 0) { + if (GetTileOwner(tile_org) != GetTileOwner(tile)) return; + } + } + + tpf->rd.cur_length++; if ((byte)bits != tpf->var2) { bits &= _tpfmode1_and[direction]; |