summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-08 21:25:35 +0000
committerrubidium <rubidium@openttd.org>2013-11-08 21:25:35 +0000
commita7fd0f8f5d18c23ee93f17f4b3f64e896203433e (patch)
tree3e697dda0e62a8813f1c57af1a813dc6ed33a9a1
parentcdd6752ead27d492f831310fee815753093f4f78 (diff)
downloadopenttd-a7fd0f8f5d18c23ee93f17f4b3f64e896203433e.tar.xz
(svn r25953) -Fix [FS#5732]: Wrong bits used when converting signal types/variants while loading savegames older than v64 (adf88)
-rw-r--r--src/saveload/afterload.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 8cf3119e1..203a492a1 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1509,13 +1509,15 @@ bool AfterLoadGame()
}
if (IsSavegameVersionBefore(64)) {
- /* copy the signal type/variant and move signal states bits */
+ /* Since now we allow different signal types and variants on a single tile.
+ * Move signal states to m4 to make room and clone the signal type/variant. */
for (TileIndex t = 0; t < map_size; t++) {
if (IsTileType(t, MP_RAILWAY) && HasSignals(t)) {
+ /* move signal states */
SetSignalStates(t, GB(_m[t].m2, 4, 4));
- SetSignalVariant(t, INVALID_TRACK, GetSignalVariant(t, TRACK_X));
- SetSignalType(t, INVALID_TRACK, GetSignalType(t, TRACK_X));
- ClrBit(_m[t].m2, 7);
+ SB(_m[t].m2, 4, 4, 0);
+ /* clone signal type and variant */
+ SB(_m[t].m2, 4, 3, GB(_m[t].m2, 0, 3));
}
}
}