diff options
author | rubidium <rubidium@openttd.org> | 2014-07-21 18:03:32 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-07-21 18:03:32 +0000 |
commit | 48d446ffeb21d540ac447f06b3bdbcc8d36684e9 (patch) | |
tree | f00b8a698e5150b6ac01bfce6687f225c9161603 /src/saveload | |
parent | 3d3fb76b7e1a1eab99a6155684485ad607c93fad (diff) | |
download | openttd-48d446ffeb21d540ac447f06b3bdbcc8d36684e9.tar.xz |
(svn r26700) -Fix [FS#6066]: incorrect saving of order backups
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/order_sl.cpp | 15 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/saveload/order_sl.cpp b/src/saveload/order_sl.cpp index 63701ffa0..d93974234 100644 --- a/src/saveload/order_sl.cpp +++ b/src/saveload/order_sl.cpp @@ -253,9 +253,11 @@ const SaveLoad *GetOrderBackupDescription() SLE_VAR(OrderBackup, user, SLE_UINT32), SLE_VAR(OrderBackup, tile, SLE_UINT32), SLE_VAR(OrderBackup, group, SLE_UINT16), - SLE_VAR(OrderBackup, service_interval, SLE_UINT32), + SLE_CONDVAR(OrderBackup, service_interval, SLE_FILE_U32 | SLE_VAR_U16, 0, 191), + SLE_CONDVAR(OrderBackup, service_interval, SLE_UINT16, 192, SL_MAX_VERSION), SLE_STR(OrderBackup, name, SLE_STR, 0), - SLE_VAR(OrderBackup, clone, SLE_UINT16), + SLE_CONDNULL(2, 0, 191), // clone (2 bytes of pointer, i.e. garbage) + SLE_CONDREF(OrderBackup, clone, REF_VEHICLE, 192, SL_MAX_VERSION), SLE_VAR(OrderBackup, cur_real_order_index, SLE_UINT8), SLE_CONDVAR(OrderBackup, cur_implicit_order_index, SLE_UINT8, 176, SL_MAX_VERSION), SLE_CONDVAR(OrderBackup, current_order_time, SLE_UINT32, 176, SL_MAX_VERSION), @@ -295,10 +297,11 @@ void Load_BKOR() } /* Only load order-backups for network clients. - * If we are a network server or not networking, then we just loaded - * a previously saved-by-server savegame. There are - * no clients with a backup anymore, so clear it. */ - if (!_networking || _network_server) { + * If we are a network server or not networking, then we just loaded a previously + * saved-by-server savegame. There are no clients with a backup, so clear it. + * Furthermore before savegame version 192 the actual content was always corrupt. + */ + if (!_networking || _network_server || IsSavegameVersionBefore(192)) { _order_backup_pool.CleanPool(); } } diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index ed97e6411..411b0e7a8 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -259,8 +259,9 @@ * 189 26450 * 190 26547 * 191 26646 + * 192 26700 */ -extern const uint16 SAVEGAME_VERSION = 191; ///< Current savegame version of OpenTTD. +extern const uint16 SAVEGAME_VERSION = 192; ///< Current savegame version of OpenTTD. SavegameType _savegame_type; ///< type of savegame we are loading |