summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-18 21:11:38 +0100
committerGitHub <noreply@github.com>2021-01-18 21:11:38 +0100
commit7da224d29d4af6333d187ccbf5104e6a1bf805f9 (patch)
tree053d174c64b3621de124df539ac42deb0ba29045 /src
parenta2bd0a14e1033d9bd1e29416c8c68f96c73d179e (diff)
downloadopenttd-7da224d29d4af6333d187ccbf5104e6a1bf805f9.tar.xz
Fix #8589, 653e7fa548: Motion counter is NewGRF-visible but not saved, leading to desyncs. (#8591)
Diffstat (limited to 'src')
-rw-r--r--src/saveload/saveload.h1
-rw-r--r--src/saveload/vehicle_sl.cpp1
2 files changed, 2 insertions, 0 deletions
diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h
index f5ec936a2..fb7761128 100644
--- a/src/saveload/saveload.h
+++ b/src/saveload/saveload.h
@@ -322,6 +322,7 @@ enum SaveLoadVersion : uint16 {
SLV_END_PATCHPACKS = 286, ///< 286 Last known patchpack to use a version just above ours.
SLV_GS_INDUSTRY_CONTROL, ///< 287 PR#7912 and PR#8115 GS industry control.
+ SLV_VEH_MOTION_COUNTER, ///< 288 PR#8591 Desync safe motion counter
SL_MAX_VERSION, ///< Highest possible saveload version
};
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 94bc37fb8..131d31519 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -612,6 +612,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
SLE_VAR(Vehicle, cur_speed, SLE_UINT16),
SLE_VAR(Vehicle, subspeed, SLE_UINT8),
SLE_VAR(Vehicle, acceleration, SLE_UINT8),
+ SLE_CONDVAR(Vehicle, motion_counter, SLE_UINT32, SLV_VEH_MOTION_COUNTER, SL_MAX_VERSION),
SLE_VAR(Vehicle, progress, SLE_UINT8),
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),