src/newgrf_industries.cpp
changeset 8100 3fcfa8594d0f
parent 8095 1ecfd01f30af
child 8106 9f527cc360cf
equal deleted inserted replaced
8099:fab936821b10 8100:3fcfa8594d0f
    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 			}