(svn r7069) -Fix: AI tried to build road from the back or side of road stop/depot (peter1138)
authorKUDr
Sun, 05 Nov 2006 18:42:25 +0000
changeset 5028 1dbceed7bedc
parent 5027 8dacdfc948d3
child 5029 455ac4f14c9b
(svn r7069) -Fix: AI tried to build road from the back or side of road stop/depot (peter1138)
ai/default/default.c
pathfind.c
--- a/ai/default/default.c	Sun Nov 05 12:22:46 2006 +0000
+++ b/ai/default/default.c	Sun Nov 05 18:42:25 2006 +0000
@@ -2806,6 +2806,7 @@
 	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;
 
--- a/pathfind.c	Sun Nov 05 12:22:46 2006 +0000
+++ b/pathfind.c	Sun Nov 05 18:42:25 2006 +0000
@@ -294,9 +294,9 @@
 	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++;