(svn r18764) -Fix [FS#3422]: split the (un)load ticks counter and signal wait counter; sometimes they might get into eachother's way

This commit is contained in:
rubidium
2010-01-09 14:43:08 +00:00
parent 6595434845
commit ad8d6e8dd2
12 changed files with 56 additions and 46 deletions

View File

@@ -1997,6 +1997,19 @@ bool AfterLoadGame()
}
}
/* Wait counter and load/unload ticks got split. */
if (CheckSavegameVersion(136)) {
Aircraft *a;
FOR_ALL_AIRCRAFT(a) {
a->turn_counter = a->current_order.IsType(OT_LOADING) ? 0 : a->load_unload_ticks;
}
Train *t;
FOR_ALL_TRAINS(t) {
t->wait_counter = t->current_order.IsType(OT_LOADING) ? 0 : t->load_unload_ticks;
}
}
/* Road stops is 'only' updating some caches */
AfterLoadRoadStops();
AfterLoadLabelMaps();

View File

@@ -1129,7 +1129,7 @@ static const OldChunks vehicle_chunk[] = {
OCL_NULL ( 1 ), ///< num_orders, now calculated
OCL_SVAR( OC_UINT8, Vehicle, cur_order_index ),
OCL_SVAR( OC_TILE, Vehicle, dest_tile ),
OCL_SVAR( OC_UINT16, Vehicle, time_counter ),
OCL_SVAR( OC_UINT16, Vehicle, load_unload_ticks ),
OCL_SVAR( OC_FILE_U16 | OC_VAR_U32, Vehicle, date_of_last_service ),
OCL_SVAR( OC_UINT16, Vehicle, service_interval ),
OCL_SVAR( OC_FILE_U8 | OC_VAR_U16, Vehicle, last_station_visited ),

View File

@@ -47,7 +47,7 @@
#include "saveload_internal.h"
extern const uint16 SAVEGAME_VERSION = 135;
extern const uint16 SAVEGAME_VERSION = 136;
SavegameType _savegame_type; ///< type of savegame we are loading

View File

@@ -495,7 +495,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Vehicle, build_year, SLE_FILE_U8 | SLE_VAR_I32, 0, 30),
SLE_CONDVAR(Vehicle, build_year, SLE_INT32, 31, SL_MAX_VERSION),
SLE_VAR(Vehicle, time_counter, SLE_UINT16),
SLE_VAR(Vehicle, load_unload_ticks, SLE_UINT16),
SLEG_CONDVAR( _cargo_paid_for, SLE_UINT16, 45, SL_MAX_VERSION),
SLE_CONDVAR(Vehicle, vehicle_flags, SLE_UINT8, 40, SL_MAX_VERSION),
@@ -540,6 +540,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Train, flags, SLE_UINT16, 100, SL_MAX_VERSION),
SLE_CONDNULL(2, 2, 59),
SLE_CONDVAR(Train, wait_counter, SLE_UINT16, 136, SL_MAX_VERSION),
SLE_CONDNULL(2, 2, 19),
/* reserve extra space in savegame here. (currently 11 bytes) */
SLE_CONDNULL(11, 2, SL_MAX_VERSION),
@@ -593,6 +595,8 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_CONDVAR(Aircraft, last_direction, SLE_UINT8, 2, SL_MAX_VERSION),
SLE_CONDVAR(Aircraft, number_consecutive_turns, SLE_UINT8, 2, SL_MAX_VERSION),
SLE_CONDVAR(Aircraft, turn_counter, SLE_UINT8, 136, SL_MAX_VERSION),
/* reserve extra space in savegame here. (currently 13 bytes) */
SLE_CONDNULL(13, 2, SL_MAX_VERSION),