summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-01-09 14:43:08 +0000
committerrubidium <rubidium@openttd.org>2010-01-09 14:43:08 +0000
commite4af35d316158767ddd19d87ac1c92086be7a71c (patch)
tree209595e66247eac0defe0806ff0f08706fc7adee /src/saveload
parentf65f276d10e528ffe2581656cfa8066a20002995 (diff)
downloadopenttd-e4af35d316158767ddd19d87ac1c92086be7a71c.tar.xz
(svn r18764) -Fix [FS#3422]: split the (un)load ticks counter and signal wait counter; sometimes they might get into eachother's way
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp13
-rw-r--r--src/saveload/oldloader_sl.cpp2
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp6
4 files changed, 20 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index d5eb046bc..a7399431d 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -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();
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index d24991b9e..a78a45244 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -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 ),
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index ed899e550..2126d54a4 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -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
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index cf646141e..e78742073 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -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),