src/newgrf_industries.cpp
changeset 7604 16666b8e91a4
parent 7599 0d6d44f403c5
child 7610 13b7d9e247d2
equal deleted inserted replaced
7603:1f067a18eb61 7604:16666b8e91a4
    57 			if (IsTileType(t, MP_WATER) == water) best_dist = dist;
    57 			if (IsTileType(t, MP_WATER) == water) best_dist = dist;
    58 		} else {
    58 		} else {
    59 			/* When the Y distance between the current row and the 'source' tile
    59 			/* When the Y distance between the current row and the 'source' tile
    60 			 * is larger than the best distance, we've found the best distance */
    60 			 * is larger than the best distance, we've found the best distance */
    61 			if ((int)TileY(t) - (int)TileY(tile) > best_dist) break;
    61 			if ((int)TileY(t) - (int)TileY(tile) > best_dist) break;
    62 			if (TileX(tile) > TileX(t)) {
    62 			if ((int)TileX(t) - (int)TileX(tile) > best_dist) {
    63 				/* We can safely skip this many tiles; from here all tiles have a
    63 				/* We can safely skip this many tiles; from here all tiles have a
    64 				 * higher or equal distance than the best distance */
    64 				 * higher or equal distance than the best distance */
    65 				t |= MapMaxX();
    65 				t |= MapMaxX();
    66 				continue;
    66 				continue;
    67 			} else {
    67 			} else if (TileX(tile) < TileX(t)) {
    68 				/* We can safely skip this many tiles; up to here all tiles have a
    68 				/* We can safely skip this many tiles; up to here all tiles have a
    69 				 * higher or equal distance than the best distance */
    69 				 * higher or equal distance than the best distance */
    70 				t += max(best_dist - dist, 0);
    70 				t += max(best_dist - dist, 0);
    71 				continue;
    71 				continue;
    72 			}
    72 			}