From 6a4be9758c1da4e64810ad1b112a0e8da3882834 Mon Sep 17 00:00:00 2001 From: glx Date: Thu, 31 May 2007 21:21:04 +0000 Subject: (svn r10006) -Fix (FS#362): allow different signal types on one tile --- src/openttd.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/openttd.cpp') diff --git a/src/openttd.cpp b/src/openttd.cpp index 062d2185b..2e20074a7 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1664,10 +1664,10 @@ bool AfterLoadGame() case MP_RAILWAY: if (HasSignals(t)) { /* convert PBS signals to combo-signals */ - if (HASBIT(_m[t].m2, 2)) SetSignalType(t, SIGTYPE_COMBO); + if (HASBIT(_m[t].m2, 2)) SetSignalType(t, TRACK_X, SIGTYPE_COMBO); /* move the signal variant back */ - SetSignalVariant(t, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC); + SetSignalVariant(t, TRACK_X, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC); CLRBIT(_m[t].m2, 3); } @@ -2001,6 +2001,18 @@ bool AfterLoadGame() _opt.diff.number_towns++; } + if (CheckSavegameVersion(64)) { + /* copy the signal type/variant and move signal states bits */ + for (TileIndex t = 0; t < map_size; t++) { + if (IsTileType(t, MP_RAILWAY) && HasSignals(t)) { + 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); + } + } + } + /* Recalculate */ Group *g; FOR_ALL_GROUPS(g) { -- cgit v1.2.3-54-g00ecf