summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKUDr <KUDr@openttd.org>2006-11-05 18:42:25 +0000
committerKUDr <KUDr@openttd.org>2006-11-05 18:42:25 +0000
commitd7a56088a59d99a7aa2ea50467f7b8f265e8ebf0 (patch)
tree25b31ec9a0c72f4795c36973f401434d8b4fc44b
parent03124c1df5b0f238b89a2e5d580e002acf6283a0 (diff)
downloadopenttd-d7a56088a59d99a7aa2ea50467f7b8f265e8ebf0.tar.xz
(svn r7069) -Fix: AI tried to build road from the back or side of road stop/depot (peter1138)
-rw-r--r--ai/default/default.c1
-rw-r--r--pathfind.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/ai/default/default.c b/ai/default/default.c
index 6794d9f26..379f4516e 100644
--- a/ai/default/default.c
+++ b/ai/default/default.c
@@ -2806,6 +2806,7 @@ static bool AiCheckRoadFinished(Player *p)
are.dest = p->ai.cur_tile_b;
tile = TILE_MASK(p->ai.cur_tile_a + TileOffsByDiagDir(dir));
+ if (IsRoadStopTile(tile) || IsTileDepotType(tile, TRANSPORT_ROAD)) return false;
bits = GetTileTrackStatus(tile, TRANSPORT_ROAD) & _ai_road_table_and[dir];
if (bits == 0) return false;
diff --git a/pathfind.c b/pathfind.c
index 9b8cfc3ec..1e724c632 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -294,9 +294,9 @@ static void TPFMode1(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
if (tpf->tracktype == TRANSPORT_ROAD) {
// road stops and depots now have a track (r4419)
// don't enter road stop from the back
- if (IsRoadStopTile(tile) && GetRoadStopDir(tile) == direction) return;
+ if (IsRoadStopTile(tile) && ReverseDiagDir(GetRoadStopDir(tile)) != direction) return;
// don't enter road depot from the back
- if (IsTileDepotType(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) == direction) return;
+ if (IsTileDepotType(tile, TRANSPORT_ROAD) && ReverseDiagDir(GetRoadDepotDirection(tile)) != direction) return;
}
tpf->rd.cur_length++;