diff options
author | yexo <yexo@openttd.org> | 2010-01-04 18:33:43 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2010-01-04 18:33:43 +0000 |
commit | b378e82676b299dc8d579cd2ac020758fbf52f84 (patch) | |
tree | 044688328cdbf84c799fd452f4c38c3132943db1 /src/saveload | |
parent | 3e131e2fece740591d9187e19789a34b36c763fa (diff) | |
download | openttd-b378e82676b299dc8d579cd2ac020758fbf52f84.tar.xz |
(svn r18719) -Feature: don't delete the rough/rocky status of a tile when it's covered by snow, this allows rocky tiles under snow if you have a variable snowline
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 27 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 2 |
2 files changed, 25 insertions, 4 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 8116b6d17..d5eb046bc 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -120,7 +120,7 @@ void SetWaterClassDependingOnSurroundings(TileIndex t, bool include_invalid_wate case MP_TREES: /* trees on shore */ - has_water |= (GetTreeGround(neighbour) == TREE_GROUND_SHORE); + has_water |= (GB(_m[neighbour].m2, 4, 2) == TREE_GROUND_SHORE); break; default: break; @@ -1437,8 +1437,8 @@ bool AfterLoadGame() if (CheckSavegameVersion(81)) { for (TileIndex t = 0; t < map_size; t++) { if (GetTileType(t) == MP_TREES) { - TreeGround groundType = GetTreeGround(t); - if (groundType != TREE_GROUND_SNOW_DESERT) SetTreeGroundDensity(t, groundType, 3); + TreeGround groundType = (TreeGround)GB(_m[t].m2, 4, 2); + if (groundType != TREE_GROUND_SNOW_DESERT) SB(_m[t].m2, 6, 2, 3); } } } @@ -1976,6 +1976,27 @@ bool AfterLoadGame() } } + /* The bits for the tree ground and tree density have + * been swapped (m2 bits 7..6 and 5..4. */ + if (CheckSavegameVersion(135)) { + for (TileIndex t = 0; t < map_size; t++) { + if (IsTileType(t, MP_CLEAR)) { + if (GetRawClearGround(t) == CLEAR_SNOW) { + SetClearGroundDensity(t, CLEAR_GRASS, GetClearDensity(t)); + SetBit(_m[t].m3, 4); + } else { + ClrBit(_m[t].m3, 4); + } + } + if (IsTileType(t, MP_TREES)) { + uint density = GB(_m[t].m2, 6, 2); + uint ground = GB(_m[t].m2, 4, 2); + uint counter = GB(_m[t].m2, 0, 4); + _m[t].m2 = ground << 6 | density << 4 | counter; + } + } + } + /* Road stops is 'only' updating some caches */ AfterLoadRoadStops(); AfterLoadLabelMaps(); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index e7e40c72d..ed899e550 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -47,7 +47,7 @@ #include "saveload_internal.h" -extern const uint16 SAVEGAME_VERSION = 134; +extern const uint16 SAVEGAME_VERSION = 135; SavegameType _savegame_type; ///< type of savegame we are loading |