diff options
author | rubidium <rubidium@openttd.org> | 2010-08-11 14:14:06 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-11 14:14:06 +0000 |
commit | ab5b0ceff219a2b12253dbd3e008cf4551608b8a (patch) | |
tree | 015b80c7c79cf97a7de8a1f8d1d82f4577895ea1 /src/saveload | |
parent | 43d6740f2d68af2223796eb2324086be18487b88 (diff) | |
download | openttd-ab5b0ceff219a2b12253dbd3e008cf4551608b8a.tar.xz |
(svn r20446) -Codechange: unify the location of the water class
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/afterload.cpp | 41 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 3 |
2 files changed, 37 insertions, 7 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index ce2ef047b..12cbf2e3e 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1543,6 +1543,41 @@ bool AfterLoadGame() } } + /* The water class was moved/unified. */ + if (CheckSavegameVersion(146)) { + for (TileIndex t = 0; t < map_size; t++) { + switch (GetTileType(t)) { + case MP_STATION: + switch (GetStationType(t)) { + case STATION_OILRIG: + case STATION_DOCK: + case STATION_BUOY: + SetWaterClass(t, (WaterClass)GB(_m[t].m3, 0, 2)); + SB(_m[t].m3, 0, 2, 0); + break; + + default: + SetWaterClass(t, WATER_CLASS_INVALID); + break; + } + break; + + case MP_WATER: + SetWaterClass(t, (WaterClass)GB(_m[t].m3, 0, 2)); + SB(_m[t].m3, 0, 2, 0); + break; + + case MP_OBJECT: + SetWaterClass(t, WATER_CLASS_INVALID); + break; + + default: + /* No water class. */ + break; + } + } + } + if (CheckSavegameVersion(86)) { for (TileIndex t = 0; t < map_size; t++) { /* Move river flag and update canals to use water class */ @@ -2153,12 +2188,6 @@ bool AfterLoadGame() FOR_ALL_DEPOTS(d) d->build_date = _date; } - if (CheckSavegameVersion(145)) { - for (TileIndex t = 0; t < map_size; t++) { - if (IsAirportTile(t)) SetWaterClass(t, WATER_CLASS_INVALID); - } - } - /* Road stops is 'only' updating some caches */ AfterLoadRoadStops(); AfterLoadLabelMaps(); diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 48c07b63e..7a9cd9eee 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -209,8 +209,9 @@ * 143 20048 * 144 20334 * 145 20376 + * 146 20446 */ -extern const uint16 SAVEGAME_VERSION = 145; ///< current savegame version of OpenTTD +extern const uint16 SAVEGAME_VERSION = 146; ///< current savegame version of OpenTTD SavegameType _savegame_type; ///< type of savegame we are loading |