(svn r14415) -Fix (r10074): void tiles could be the nearest 'land' for water industries
authorsmatz
Mon, 29 Sep 2008 18:23:56 +0000
changeset 10202 2dcd2c490934
parent 10201 4c181fbe8f2a
child 10203 cec7c76ca505
(svn r14415) -Fix (r10074): void tiles could be the nearest 'land' for water industries
src/newgrf_industries.cpp
--- a/src/newgrf_industries.cpp	Mon Sep 29 16:27:02 2008 +0000
+++ b/src/newgrf_industries.cpp	Mon Sep 29 18:23:56 2008 +0000
@@ -52,7 +52,7 @@
 	TileIndex t;
 	int best_dist;
 	for (t = 0; t < MapSize(); t++) {
-		if (IsTileType(t, MP_WATER) == water) break;
+		if (!IsTileType(t, MP_VOID) && IsTileType(t, MP_WATER) == water) break;
 	}
 	if (t == MapSize() && !water) return 0x200;
 	best_dist = DistanceManhattan(tile, t);
@@ -60,7 +60,7 @@
 	for (; t < MapSize(); t++) {
 		int dist = DistanceManhattan(tile, t);
 		if (dist < best_dist) {
-			if (IsTileType(t, MP_WATER) == water) best_dist = dist;
+			if (!IsTileType(t, MP_VOID) && IsTileType(t, MP_WATER) == water) best_dist = dist;
 		} else {
 			/* When the Y distance between the current row and the 'source' tile
 			 * is larger than the best distance, we've found the best distance */