summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-06 14:54:26 +0100
committerErich Eckner <git@eckner.net>2018-11-16 19:16:08 +0100
commit84bb951c877604b01b1971249fa6fbcf060e47bf (patch)
tree41dfb8403307465d7669ae73cd92909dead53c3b /src
parent7bd8e6c67f1caac99c9aadca791b7edad63d52e7 (diff)
downloadopenttd-84bb951c877604b01b1971249fa6fbcf060e47bf.tar.xz
WIP: fix loading of old savegamesunderground-save-load
Diffstat (limited to 'src')
-rw-r--r--src/fios.h2
-rw-r--r--src/fios_gui.cpp1
-rw-r--r--src/saveload/map_sl.cpp3
-rw-r--r--src/saveload/saveload.cpp3
4 files changed, 6 insertions, 3 deletions
diff --git a/src/fios.h b/src/fios.h
index 5e17e8ee1..0aad396c5 100644
--- a/src/fios.h
+++ b/src/fios.h
@@ -28,7 +28,7 @@ struct LoadCheckData {
StringID error; ///< Error message from loading. INVALID_STRING_ID if no error.
char *error_data; ///< Data to pass to SetDParamStr when displaying #error.
- uint32 map_size_x, map_size_y;
+ uint32 map_size_x, map_size_y, layer_count;
Date current_date;
GameSettings settings;
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 9aa5277ac..161b162f2 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -53,6 +53,7 @@ void LoadCheckData::Clear()
this->error_data = NULL;
this->map_size_x = this->map_size_y = 256; // Default for old savegames which do not store mapsize.
+ this->layer_count = 1; // Default for old savegames which do not have multiple layers.
this->current_date = 0;
memset(&this->settings, 0, sizeof(this->settings));
diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp
index e2e9f4877..fc95aa529 100644
--- a/src/saveload/map_sl.cpp
+++ b/src/saveload/map_sl.cpp
@@ -26,7 +26,7 @@ static uint32 _layer_count;
static const SaveLoadGlobVarList _map_dimensions[] = {
SLEG_CONDVAR(_map_dim_x, SLE_UINT32, 6, SL_MAX_VERSION),
SLEG_CONDVAR(_map_dim_y, SLE_UINT32, 6, SL_MAX_VERSION),
- SLEG_CONDVAR(_layer_count, SLE_UINT32, 6, SL_MAX_VERSION),
+ SLEG_CONDVAR(_layer_count, SLE_UINT32, 202, SL_MAX_VERSION),
SLEG_END()
};
@@ -49,6 +49,7 @@ static void Check_MAPS()
SlGlobList(_map_dimensions);
_load_check_data.map_size_x = _map_dim_x;
_load_check_data.map_size_y = _map_dim_y;
+ _load_check_data.layer_count = _layer_count;
}
static const uint MAP_SL_BUF_SIZE = 4096;
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 8cf5ee36b..4b278b402 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -270,8 +270,9 @@
* 200 #6805 Extend railtypes to 64, adding uint16 to map array.
* 201 #6885 Extend NewGRF persistant storages.
* 202 #6867 Increase industry cargo slots to 16 in, 16 out
+ * 203 underground added
*/
-extern const uint16 SAVEGAME_VERSION = 202; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 203; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.