(svn r13932) -Add [YAPP]: PBS signals added to the map array. The signals are drawn using the old Patch-like PBS sprites. (michi_cc)

This commit is contained in:
rubidium
2008-08-02 22:48:43 +00:00
parent f1666c7062
commit fc47ae96c4
9 changed files with 138 additions and 31 deletions

View File

@@ -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();