diff options
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 |