From a973e457193b41afbfaa468be1c2fe22c484c845 Mon Sep 17 00:00:00 2001 From: tron Date: Wed, 17 Jan 2007 06:54:03 +0000 Subject: (svn r8184) if cascade -> switch --- src/openttd.cpp | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/openttd.cpp b/src/openttd.cpp index 118eeb30e..b29e92f2e 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1517,29 +1517,37 @@ bool AfterLoadGame(void) * room for PBS. Now in version 21 move it back :P. */ if (CheckSavegameVersion(21) && !CheckSavegameVersion(15)) { for (TileIndex t = 0; t < map_size; t++) { - if (IsTileType(t, MP_RAILWAY)) { - if (HasSignals(t)) { - // convert PBS signals to combo-signals - if (HASBIT(_m[t].m4, 2)) SetSignalType(t, SIGTYPE_COMBO); - - // move the signal variant back - SetSignalVariant(t, HASBIT(_m[t].m4, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC); - CLRBIT(_m[t].m4, 3); - } + switch (GetTileType(t)) { + case MP_RAILWAY: + if (HasSignals(t)) { + // convert PBS signals to combo-signals + if (HASBIT(_m[t].m4, 2)) SetSignalType(t, SIGTYPE_COMBO); - // Clear PBS reservation on track - if (!IsTileDepotType(t, TRANSPORT_RAIL)) { - SB(_m[t].m4, 4, 4, 0); - } else { - CLRBIT(_m[t].m3, 6); - } - } + // move the signal variant back + SetSignalVariant(t, HASBIT(_m[t].m4, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC); + CLRBIT(_m[t].m4, 3); + } + + // Clear PBS reservation on track + if (!IsTileDepotType(t, TRANSPORT_RAIL)) { + SB(_m[t].m4, 4, 4, 0); + } else { + CLRBIT(_m[t].m3, 6); + } + break; + + case MP_STREET: + // Clear PBS reservation on crossing + if (IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0); + break; - // Clear PBS reservation on crossing - if (IsTileType(t, MP_STREET) && IsLevelCrossing(t)) CLRBIT(_m[t].m5, 0); + case MP_STATION: + // Clear PBS reservation on station + CLRBIT(_m[t].m3, 6); + break; - // Clear PBS reservation on station - if (IsTileType(t, MP_STATION)) CLRBIT(_m[t].m3, 6); + default: break; + } } } -- cgit v1.2.3-70-g09d2