changeset 15140:8676e88fecb0 draft

(svn r19769) -Fix [FS#3820]: MV_VOID tiles shall have no tropic zone.
author frosch <frosch@openttd.org>
date Sat, 08 May 2010 14:43:59 +0000
parents 7c6ac8de8bfb
children 22cf59306663
files src/landscape.cpp src/saveload/afterload.cpp src/tile_map.h
diffstat 3 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -831,6 +831,8 @@
 	for (TileIndex tile = 0; tile != MapSize(); ++tile) {
 		if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 
+		if (!IsValidTile(tile)) continue;
+
 		for (data = _make_desert_or_rainforest_data;
 				data != endof(_make_desert_or_rainforest_data); ++data) {
 			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
@@ -849,6 +851,8 @@
 	for (TileIndex tile = 0; tile != MapSize(); ++tile) {
 		if ((tile % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 
+		if (!IsValidTile(tile)) continue;
+
 		for (data = _make_desert_or_rainforest_data;
 				data != endof(_make_desert_or_rainforest_data); ++data) {
 			TileIndex t = AddTileIndexDiffCWrap(tile, *data);
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -2101,6 +2101,13 @@
 		}
 	}
 
+	if (CheckSavegameVersion(141)) {
+		for (TileIndex t = 0; t < map_size; t++) {
+			/* Reset tropic zone for VOID tiles, they shall not have any. */
+			if (IsTileType(t, MP_VOID)) SetTropicZone(t, TROPICZONE_NORMAL);
+		}
+	}
+
 	/* Road stops is 'only' updating some caches */
 	AfterLoadRoadStops();
 	AfterLoadLabelMaps();
--- a/src/tile_map.h
+++ b/src/tile_map.h
@@ -186,6 +186,7 @@
 static inline void SetTropicZone(TileIndex tile, TropicZone type)
 {
 	assert(tile < MapSize());
+	assert(!IsTileType(tile, MP_VOID) || type == TROPICZONE_NORMAL);
 	SB(_m[tile].m6, 0, 2, type);
 }