summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-01-17 06:54:03 +0000
committertron <tron@openttd.org>2007-01-17 06:54:03 +0000
commita973e457193b41afbfaa468be1c2fe22c484c845 (patch)
tree53f8181d7fabf47647ba63eec92301d393936371 /src
parent2742b5fe253f2d635e4e7e50b919aa7dd4c3b223 (diff)
downloadopenttd-a973e457193b41afbfaa468be1c2fe22c484c845.tar.xz
(svn r8184) if cascade -> switch
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp48
1 files changed, 28 insertions, 20 deletions
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;
+ }
}
}