summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-08-02 22:48:43 +0000
committerrubidium <rubidium@openttd.org>2008-08-02 22:48:43 +0000
commitfc47ae96c42f49df29e7bc812eb446a49c41e71a (patch)
tree579def525f3daf00a22a8597e6be680ed28fd831 /src/openttd.cpp
parentf1666c7062cb21c1697cc90a2c6ed13735000e82 (diff)
downloadopenttd-fc47ae96c42f49df29e7bc812eb446a49c41e71a.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.cpp40
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();