summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-01-19 20:04:09 +0000
committerterkhen <terkhen@openttd.org>2011-01-19 20:04:09 +0000
commitd426906a010f9e7355986400edcbe1d84b6a70e2 (patch)
treecbcbd03e43978909338f73f3dbb075e01d26216e /src/saveload
parentbe44f1306f633448e88b0a460205b1a6af927218 (diff)
downloadopenttd-d426906a010f9e7355986400edcbe1d84b6a70e2.tar.xz
(svn r21862) -Codechange: Unify subtype handling between road vehicles and trains.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp3
-rw-r--r--src/saveload/vehicle_sl.cpp17
2 files changed, 19 insertions, 1 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index f4d59ca85..4d68133bc 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -221,8 +221,9 @@
* 154 21426
* 155 21453
* 156 21728
+ * 157 21862
*/
-extern const uint16 SAVEGAME_VERSION = 156; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 157; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 398f74e2f..f85719e38 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -308,6 +308,23 @@ void AfterLoadVehicles(bool part_of_load)
}
}
+ if (IsSavegameVersionBefore(157)) {
+ /* The road vehicle subtype was converted to a flag. */
+ RoadVehicle *rv;
+ FOR_ALL_ROADVEHICLES(rv) {
+ if (rv->subtype == 0) {
+ /* The road vehicle is at the front. */
+ rv->SetFrontEngine();
+ } else if (rv->subtype == 1) {
+ /* The road vehicle is an articulated part. */
+ rv->subtype = 0;
+ rv->SetArticulatedPart();
+ } else {
+ NOT_REACHED();
+ }
+ }
+ }
+
CheckValidVehicles();
FOR_ALL_VEHICLES(v) {