diff options
author | rubidium <rubidium@openttd.org> | 2008-08-02 22:48:43 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-08-02 22:48:43 +0000 |
commit | fe4f23dba23ba7553304961773a74bc1037e12a7 (patch) | |
tree | 579def525f3daf00a22a8597e6be680ed28fd831 /src/openttd.cpp | |
parent | ad4fdb76fc51d6af87d79c734a94407dca501de3 (diff) | |
download | openttd-fe4f23dba23ba7553304961773a74bc1037e12a7.tar.xz |
(svn r13932) -Add [YAPP]: PBS signals added to the map array. The signals are drawn using the old Patch-like PBS sprites. (michi_cc)
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 29f6bbb79..e09a8501b 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -2464,6 +2464,46 @@ bool AfterLoadGame() } } + /* Move the signal variant back up one bit for PBS. We don't convert the old PBS + * format here, as an old layout wouldn't work properly anyway. To be safe, we + * clear any possible PBS reservations as well. */ + if (CheckSavegameVersion(100)) { + for (TileIndex t = 0; t < map_size; t++) { + switch (GetTileType(t)) { + case MP_RAILWAY: + if (HasSignals(t)) { + /* move the signal variant */ + SetSignalVariant(t, TRACK_UPPER, HasBit(_m[t].m2, 2) ? SIG_SEMAPHORE : SIG_ELECTRIC); + SetSignalVariant(t, TRACK_LOWER, HasBit(_m[t].m2, 6) ? SIG_SEMAPHORE : SIG_ELECTRIC); + ClrBit(_m[t].m2, 2); + ClrBit(_m[t].m2, 6); + } + + /* Clear PBS reservation on track */ + if (IsRailDepot(t) ||IsRailWaypoint(t)) { + SetDepotWaypointReservation(t, false); + } else { + SetTrackReservation(t, TRACK_BIT_NONE); + } + break; + + case MP_ROAD: /* Clear PBS reservation on crossing */ + if (IsLevelCrossing(t)) SetCrossingReservation(t, false); + break; + + case MP_STATION: /* Clear PBS reservation on station */ + if (IsRailwayStation(t)) SetRailwayStationReservation(t, false); + break; + + case MP_TUNNELBRIDGE: /* Clear PBS reservation on tunnels/birdges */ + if (GetTunnelBridgeTransportType(t) == TRANSPORT_RAIL) SetTunnelBridgeReservation(t, false); + break; + + default: break; + } + } + } + GamelogPrintDebug(1); return InitializeWindowsAndCaches(); |