From a7fd0f8f5d18c23ee93f17f4b3f64e896203433e Mon Sep 17 00:00:00 2001 From: rubidium Date: Fri, 8 Nov 2013 21:25:35 +0000 Subject: (svn r25953) -Fix [FS#5732]: Wrong bits used when converting signal types/variants while loading savegames older than v64 (adf88) --- src/saveload/afterload.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') 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)); } } } -- cgit v1.2.3-54-g00ecf