@@ -244,27 +244,29 @@ static void Ptrs_ORDL()
FOR_ALL_ORDER_LISTS(list) {
SlObject(list, GetOrderListDescription());
}
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),
SLE_CONDVAR(OrderBackup, vehicle_flags, SLE_UINT16, 180, SL_MAX_VERSION),
SLE_REF(OrderBackup, orders, REF_ORDER),
SLE_END()
};
return _order_backup_desc;
@@ -286,28 +288,29 @@ static void Save_BKOR()
void Load_BKOR()
int index;
while ((index = SlIterateArray()) != -1) {
/* 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()
OrderBackup *ob;
FOR_ALL_ORDER_BACKUPS(ob) {
@@ -250,26 +250,27 @@
* 180 24998 1.3.x
* 181 25012
* 182 25296
* 183 25363
* 184 25508
* 185 25620
* 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!
char _savegame_format[8]; ///< how to compress savegames
bool _do_autosave; ///< are we doing an autosave at the moment?
/** What are we currently doing? */
enum SaveLoadAction {
SLA_LOAD, ///< loading
Status change: