summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2019-04-27 14:30:06 +0100
committerPeterN <peter@fuzzle.org>2019-04-29 17:46:28 +0100
commit63a7df027df0aa5655cabf32e88fe2ee44422c1d (patch)
treeee820186f4bce7e85b02e057a899097f74583f2a
parentd9f9a64389ebe66b2dfa7b16cd66ed463ab2cec7 (diff)
downloadopenttd-63a7df027df0aa5655cabf32e88fe2ee44422c1d.tar.xz
Fix 5db883f: Railtype bits were moved too late, leading to rails under bridges losing their type
-rw-r--r--src/saveload/afterload.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 06cbbd17d..6b273e026 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1139,6 +1139,38 @@ bool AfterLoadGame()
}
}
+ /* Railtype moved from m3 to m8 in version SLV_EXTEND_RAILTYPES. */
+ if (IsSavegameVersionBefore(SLV_EXTEND_RAILTYPES)) {
+ 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;
+ }
+ }
+ }
+
if (IsSavegameVersionBefore(SLV_42)) {
Vehicle *v;
@@ -1220,38 +1252,6 @@ bool AfterLoadGame()
}
}
- /* Railtype moved from m3 to m8 in version SLV_EXTEND_RAILTYPES. */
- if (IsSavegameVersionBefore(SLV_EXTEND_RAILTYPES)) {
- 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(SLV_24)) {
RailType min_rail = RAILTYPE_ELECTRIC;