summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;
+ }
}
}