ai/trolly/trolly.c
changeset 3071 6f3417a859d4
parent 3055 ed20cba49858
child 3144 33e42feae531
--- a/ai/trolly/trolly.c	Thu Feb 23 11:53:48 2006 +0000
+++ b/ai/trolly/trolly.c	Thu Feb 23 12:24:19 2006 +0000
@@ -21,6 +21,7 @@
 #include "../../openttd.h"
 #include "../../debug.h"
 #include "../../functions.h"
+#include "../../road.h"
 #include "../../table/strings.h"
 #include "../../map.h"
 #include "../../tile.h"
@@ -793,8 +794,7 @@
 		tile = p->ainew.path_info.route[i];
 		for (j = 0; j < 4; j++) {
 			if (IsTileType(tile + TileOffsByDir(j), MP_STREET)) {
-				// Its a street, test if it is a depot
-				if (_m[tile + TileOffsByDir(j)].m5 & 0x20) {
+				if (GetRoadType(tile + TileOffsByDir(j)) == ROAD_DEPOT) {
 					// We found a depot, is it ours? (TELL ME!!!)
 					if (IsTileOwner(tile + TileOffsByDir(j), _current_player)) {
 						// Now, is it pointing to the right direction.........
@@ -1100,7 +1100,7 @@
 	int res = 0;
 	assert(p->ainew.state == AI_STATE_BUILD_DEPOT);
 
-	if (IsTileType(p->ainew.depot_tile, MP_STREET) && _m[p->ainew.depot_tile].m5 & 0x20) {
+	if (IsTileType(p->ainew.depot_tile, MP_STREET) && GetRoadType(p->ainew.depot_tile) == ROAD_DEPOT) {
 		if (IsTileOwner(p->ainew.depot_tile, _current_player)) {
 			// The depot is already builded!
 			p->ainew.state = AI_STATE_BUILD_VEHICLE;