summaryrefslogtreecommitdiff
path: root/src/pathfind.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-04 14:08:02 +0000
committersmatz <smatz@openttd.org>2008-02-04 14:08:02 +0000
commita783cb333b0f9992d89d5b5fb79650dc8b1e5d18 (patch)
tree594576bd7482acff464246b21001427eed43043f /src/pathfind.cpp
parent71b0d5f09156841b8d6728ab926000f0d6305f82 (diff)
downloadopenttd-a783cb333b0f9992d89d5b5fb79650dc8b1e5d18.tar.xz
(svn r12055) -Fix: another way to fix AI trying to build road through depots
Diffstat (limited to 'src/pathfind.cpp')
-rw-r--r--src/pathfind.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 06374666b..9714a2bb0 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -287,7 +287,8 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
tpf->the_dir = (Trackdir)((_otherdir_mask[direction] & (byte)(1 << i)) ? (i + 8) : i);
RememberData rd = tpf->rd;
- if (TPFSetTileBit(tpf, tile, tpf->the_dir) &&
+ /* make sure we are not leaving from invalid side */
+ if (TPFSetTileBit(tpf, tile, tpf->the_dir) && CanAccessTileInDir(tile, TrackdirToExitdir(tpf->the_dir), tpf->tracktype) &&
!tpf->enum_proc(tile, tpf->userdata, tpf->the_dir, tpf->rd.cur_length, &tpf->rd.pft_var6) ) {
TPFMode1(tpf, tile, _tpf_new_direction[tpf->the_dir]);
}