From 5b77a63ecfabe3537e10e681fac765fc5c46be10 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 8 May 2010 14:43:59 +0000 Subject: [PATCH] (svn r19769) -Fix [FS#3820]: MV_VOID tiles shall have no tropic zone. --- src/landscape.cpp | 4 ++++ src/saveload/afterload.cpp | 7 +++++++ src/tile_map.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/landscape.cpp b/src/landscape.cpp index 2677014f7a..25b41d130c 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -831,6 +831,8 @@ static void CreateDesertOrRainForest() 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 @@ static void CreateDesertOrRainForest() 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); diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index c8e2e5e730..4ff9157424 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2101,6 +2101,13 @@ bool AfterLoadGame() } } + 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(); diff --git a/src/tile_map.h b/src/tile_map.h index fcbe2199c0..393b89e017 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -186,6 +186,7 @@ static inline bool IsTileOwner(TileIndex tile, Owner owner) 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); }