Changeset - r21576:8f655ba7bab2
[Not reviewed]
master
0 2 0
rubidium - 10 years ago 2014-07-21 18:03:32
rubidium@openttd.org
(svn r26700) -Fix [FS#6066]: incorrect saving of order backups
2 files changed with 11 insertions and 7 deletions:
0 comments (0 inline, 0 general)
src/saveload/order_sl.cpp
Show inline comments
 
@@ -250,15 +250,17 @@ static void Ptrs_ORDL()
 
const SaveLoad *GetOrderBackupDescription()
 
{
 
	static const SaveLoad _order_backup_desc[] = {
 
		     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),
 
		 SLE_CONDVAR(OrderBackup, lateness_counter,         SLE_INT32,                 176, SL_MAX_VERSION),
 
		 SLE_CONDVAR(OrderBackup, timetable_start,          SLE_INT32,                 176, SL_MAX_VERSION),
 
		 SLE_CONDVAR(OrderBackup, vehicle_flags,            SLE_FILE_U8 | SLE_VAR_U16, 176, 179),
 
@@ -292,16 +294,17 @@ void Load_BKOR()
 
		/* set num_orders to 0 so it's a valid OrderList */
 
		OrderBackup *ob = new (index) OrderBackup();
 
		SlObject(ob, GetOrderBackupDescription());
 
	}
 

	
 
	/* 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();
 
	}
 
}
 

	
 
static void Ptrs_BKOR()
 
{
src/saveload/saveload.cpp
Show inline comments
 
@@ -256,14 +256,15 @@
 
 *  186   25833
 
 *  187   25899
 
 *  188   26169   1.4.x
 
 *  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
 

	
 
uint32 _ttdp_version;     ///< version of TTDP savegame (if applicable)
 
uint16 _sl_version;       ///< the major savegame version identifier
 
byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
0 comments (0 inline, 0 general)