changeset 831:3a430e6d2015 draft

(svn r1302) -Fix: [ 1091655 ] In some older maps somehow water is owned by OWNER_NONE instead of OWNER_WATER. -Fix: On InitializeLandscape the map was made MP_WATER, but OWNER_NONE. When ConvertGroundTilesIntoWaterTiles() is not called, this gives big problems (see above). Now the owner is set to OWNER_WATER by default.
author truelight <truelight@openttd.org>
date Thu, 30 Dec 2004 10:29:28 +0000
parents e37cdaaa9a7f
children 5a143fa99492
files landscape.c ttd.c
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/landscape.c
+++ b/landscape.c
@@ -483,7 +483,7 @@
 	uint map_size = MapSize();
 	int i;
 
-	memset(_map_owner, OWNER_NONE, map_size);
+	memset(_map_owner, OWNER_WATER, map_size);
 	memset(_map2, 0, map_size * sizeof(uint16));
 	memset(_map3_lo, 0, map_size);
 	memset(_map3_hi, 0, map_size);
--- a/ttd.c
+++ b/ttd.c
@@ -1229,6 +1229,21 @@
 		UpdateCurrencies();
 	}
 
+	/* In old version there seems to be a problem that water is owned by
+	    OWNER_NONE, not OWNER_WATER.. I can't replicate it for the current
+	    (0x402) version, so I just check when versions are older, and then
+	    walk through the whole map.. */
+	if (version <= 0x402) {
+		TileIndex tile = TILE_XY(0,0);
+		uint w = MapSizeX();
+		uint h = MapSizeY();
+
+		BEGIN_TILE_LOOP(tile_cur, w, h, tile)
+			if (IS_TILETYPE(tile_cur, MP_WATER) && _map_owner[tile_cur] != OWNER_WATER)
+				_map_owner[tile_cur] = OWNER_WATER;
+		END_TILE_LOOP(tile_cur, w, h, tile)
+	}
+
 	// convert road side to my format.
 	if (_opt.road_side) _opt.road_side = 1;