pathfind.c
changeset 1901 03bf9bf99319
parent 1891 862800791170
child 1977 37bbebf94434
equal deleted inserted replaced
1900:1f3309a61546 1901:03bf9bf99319
   131 	RememberData rd;
   131 	RememberData rd;
   132 	int owner = -1;
   132 	int owner = -1;
   133 
   133 
   134 	if (tpf->tracktype == TRANSPORT_RAIL) {
   134 	if (tpf->tracktype == TRANSPORT_RAIL) {
   135 		if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE)) {
   135 		if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE)) {
   136 			owner = _map_owner[tile];
   136 			owner = GetTileOwner(tile);
   137 			/* Check if we are on the middle of a bridge (has no owner) */
   137 			/* Check if we are on the middle of a bridge (has no owner) */
   138 			if (IsTileType(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xC0) == 0xC0)
   138 			if (IsTileType(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xC0) == 0xC0)
   139 				owner = -1;
   139 				owner = -1;
   140 		}
   140 		}
   141 	}
   141 	}
   148 	/* Check in case of rail if the owner is the same */
   148 	/* Check in case of rail if the owner is the same */
   149 	if (tpf->tracktype == TRANSPORT_RAIL) {
   149 	if (tpf->tracktype == TRANSPORT_RAIL) {
   150 		if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE))
   150 		if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE))
   151 			/* Check if we are on the middle of a bridge (has no owner) */
   151 			/* Check if we are on the middle of a bridge (has no owner) */
   152 			if (!IsTileType(tile, MP_TUNNELBRIDGE) || (_map5[tile] & 0xC0) != 0xC0)
   152 			if (!IsTileType(tile, MP_TUNNELBRIDGE) || (_map5[tile] & 0xC0) != 0xC0)
   153 				if (owner != -1 && _map_owner[tile] != owner)
   153 				if (owner != -1 && !IsTileOwner(tile, owner))
   154 					return;
   154 					return;
   155 	}
   155 	}
   156 
   156 
   157 	if (++tpf->rd.cur_length > 50)
   157 	if (++tpf->rd.cur_length > 50)
   158 		return;
   158 		return;
   294 		if (IsTileType(tile_org, MP_RAILWAY) || IsTileType(tile_org, MP_STATION) || IsTileType(tile_org, MP_TUNNELBRIDGE))
   294 		if (IsTileType(tile_org, MP_RAILWAY) || IsTileType(tile_org, MP_STATION) || IsTileType(tile_org, MP_TUNNELBRIDGE))
   295 			if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE))
   295 			if (IsTileType(tile, MP_RAILWAY) || IsTileType(tile, MP_STATION) || IsTileType(tile, MP_TUNNELBRIDGE))
   296 				/* Check if we are on a bridge (middle parts don't have an owner */
   296 				/* Check if we are on a bridge (middle parts don't have an owner */
   297 				if (!IsTileType(tile, MP_TUNNELBRIDGE) || (_map5[tile] & 0xC0) != 0xC0)
   297 				if (!IsTileType(tile, MP_TUNNELBRIDGE) || (_map5[tile] & 0xC0) != 0xC0)
   298 					if (!IsTileType(tile_org, MP_TUNNELBRIDGE) || (_map5[tile_org] & 0xC0) != 0xC0)
   298 					if (!IsTileType(tile_org, MP_TUNNELBRIDGE) || (_map5[tile_org] & 0xC0) != 0xC0)
   299 						if (_map_owner[tile_org] != _map_owner[tile])
   299 						if (GetTileOwner(tile_org) != GetTileOwner(tile))
   300 							return;
   300 							return;
   301 	}
   301 	}
   302 
   302 
   303 	tpf->rd.cur_length++;
   303 	tpf->rd.cur_length++;
   304 
   304