ai.c
changeset 1901 fb05044cf5c3
parent 1891 92a3b0aa0946
child 1926 68d60188a22f
--- a/ai.c	Sat Jun 04 07:36:28 2005 +0000
+++ b/ai.c	Sat Jun 04 11:56:32 2005 +0000
@@ -3637,8 +3637,8 @@
 	byte m5;
 
 	if (IsTileType(tile, MP_RAILWAY)) {
-		if (_map_owner[tile] != _current_player)
-			return;
+		if (!IsTileOwner(tile, _current_player)) return;
+
 		m5 = _map5[tile];
 		if ((m5&~0x3) != 0xC0) {
 is_rail_crossing:;
@@ -3696,8 +3696,7 @@
 			DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 		}
 	} else if (IsTileType(tile, MP_STREET)) {
-		if (_map_owner[tile] != _current_player)
-			return;
+		if (!IsTileOwner(tile, _current_player)) return;
 
 		if ( (_map5[tile]&0xF0) == 0x10)
 			goto is_rail_crossing;
@@ -3707,19 +3706,19 @@
 
 			// Check if there are any stations around.
 			if (IsTileType(tile + TILE_XY(-1,0), MP_STATION) &&
-					_map_owner[tile + TILE_XY(-1,0)] == _current_player)
+					IsTileOwner(tile + TILE_XY(-1, 0), _current_player))
 						return;
 
 			if (IsTileType(tile + TILE_XY(1,0), MP_STATION) &&
-					_map_owner[tile + TILE_XY(1,0)] == _current_player)
+					IsTileOwner(tile + TILE_XY(1, 0), _current_player))
 						return;
 
 			if (IsTileType(tile + TILE_XY(0,-1), MP_STATION) &&
-					_map_owner[tile + TILE_XY(0,-1)] == _current_player)
+					IsTileOwner(tile + TILE_XY(0, -1), _current_player))
 						return;
 
 			if (IsTileType(tile + TILE_XY(0,1), MP_STATION) &&
-					_map_owner[tile + TILE_XY(0,1)] == _current_player)
+					IsTileOwner(tile + TILE_XY(0, 1), _current_player))
 						return;
 
 			dir = _map5[tile] & 3;
@@ -3735,7 +3734,7 @@
 	} else if (IsTileType(tile, MP_TUNNELBRIDGE)) {
 		byte b;
 
-		if (_map_owner[tile] != _current_player || (_map5[tile] & 0xC6) != 0x80)
+		if (!IsTileOwner(tile, _current_player) || (_map5[tile] & 0xC6) != 0x80)
 			return;
 
 		m5 = 0;