summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-05-20 11:03:14 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-01-24 20:47:40 +0000
commit225790892d923eb208af3844f4c08606afab046a (patch)
tree798bb99ff01eceeaee362ee280494bb5c6cf7658 /src/saveload
parent479f13fc4133f2970aff82d2d0fb9b3c0cb919da (diff)
downloadopenttd-225790892d923eb208af3844f4c08606afab046a.tar.xz
Change: Make ships stop and change direction slowly instead of instantly turning.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp3
-rw-r--r--src/saveload/vehicle_sl.cpp13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 7f5b10ac5..29adb40c9 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -273,8 +273,9 @@
* 201 #6885 Extend NewGRF persistant storages.
* 202 #6867 Increase industry cargo slots to 16 in, 16 out
* 203 #7072 Add path cache for ships
+ * 204 #7065 Add extra rotation stages for ships.
*/
-extern const uint16 SAVEGAME_VERSION = 203; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 204; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
FileToSaveLoad _file_to_saveload; ///< File to save or load in the openttd loop.
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 1e01f3f67..76fd5af5a 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -368,6 +368,14 @@ void AfterLoadVehicles(bool part_of_load)
v->SetServiceIntervalIsPercent(c->settings.vehicle.servint_ispercent);
}
}
+
+ if (IsSavegameVersionBefore(204)) {
+ /* Ship rotation added */
+ Ship *s;
+ FOR_ALL_SHIPS(s) {
+ s->rotation = s->direction;
+ }
+ }
}
CheckValidVehicles();
@@ -753,8 +761,9 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
static const SaveLoad _ship_desc[] = {
SLE_WRITEBYTE(Vehicle, type, VEH_SHIP),
SLE_VEH_INCLUDE(),
- SLE_VAR(Ship, state, SLE_UINT8),
- SLE_CONDDEQUE(Ship, path, SLE_UINT8, 203, SL_MAX_VERSION),
+ SLE_VAR(Ship, state, SLE_UINT8),
+ SLE_CONDDEQUE(Ship, path, SLE_UINT8, 203, SL_MAX_VERSION),
+ SLE_CONDVAR(Ship, rotation, SLE_UINT8, 204, SL_MAX_VERSION),
SLE_CONDNULL(16, 2, 143), // old reserved space