summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-07-22 23:47:15 +0100
committerPeterN <peter@fuzzle.org>2018-07-26 13:27:40 +0100
commit5db883fbe9b8ef6171bfafc145a80932c3920504 (patch)
treede3ec131897c708f3fd960e9bc7cb1865d32fe7e /src/saveload
parent65548c37a840ca48378180df1bf8857b087f7329 (diff)
downloadopenttd-5db883fbe9b8ef6171bfafc145a80932c3920504.tar.xz
Change: Move rail type bits from m3 to m8.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp32
-rw-r--r--src/saveload/saveload.cpp3
2 files changed, 34 insertions, 1 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 33c49fb61..cca9ad328 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1214,6 +1214,38 @@ bool AfterLoadGame()
}
}
+ /* Railtype moved from m3 to m8 in version 200. */
+ if (IsSavegameVersionBefore(200)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ switch (GetTileType(t)) {
+ case MP_RAILWAY:
+ SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
+ break;
+
+ case MP_ROAD:
+ if (IsLevelCrossing(t)) {
+ SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
+ }
+ break;
+
+ case MP_STATION:
+ if (HasStationRail(t)) {
+ SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
+ }
+ break;
+
+ case MP_TUNNELBRIDGE:
+ if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) {
+ SetRailType(t, (RailType)GB(_m[t].m3, 0, 4));
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ }
+
/* Elrails got added in rev 24 */
if (IsSavegameVersionBefore(24)) {
RailType min_rail = RAILTYPE_ELECTRIC;
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 692f73cf2..d02dfcbc6 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -267,8 +267,9 @@
* 197 27978 1.8.x
* 198
* 199
+ * 200
*/
-extern const uint16 SAVEGAME_VERSION = 199; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 200; ///< 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.