diff options
author | Darkvater <darkvater@openttd.org> | 2006-01-29 18:57:26 +0000 |
---|---|---|
committer | Darkvater <darkvater@openttd.org> | 2006-01-29 18:57:26 +0000 |
commit | 4e09974975ba47b755ac00b58aae880fa297e161 (patch) | |
tree | a71e925a12583a807b9e921fd125c8ae1b8e8721 /openttd.c | |
parent | bb49381cd3ce8c95e459d1f542fc15064d7b17ea (diff) | |
download | openttd-4e09974975ba47b755ac00b58aae880fa297e161.tar.xz |
(svn r3472) - [PBS] Remove from trunk. Anyone interested can still find it in branch/pbs. This reverts revisions r3158, r3140, r3075, r2977, r2674, r2625, r2621, r2529, r2528, r2525, r2524, r2519, r2517, r2516, r2507, r2499. (in conjunction with Tron)
- The only change is that the nsignalsw.grf file is kept and that existing nightlies with PBS signals get those signals converted to combo-signals.
Diffstat (limited to 'openttd.c')
-rw-r--r-- | openttd.c | 45 |
1 files changed, 31 insertions, 14 deletions
@@ -1249,20 +1249,6 @@ bool AfterLoadGame(void) FOR_ALL_TOWNS(t) UpdateTownMaxPass(t); } - /* From version 15.0, we moved a semaphore bit from bit 2 to bit 3 in m4, making - * room for PBS. While doing that, clean some blocks that should be empty, for PBS. */ - if (CheckSavegameVersion(15)) { - BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) { - if (IsTileType(tile, MP_RAILWAY) && HasSignals(tile) && HASBIT(_m[tile].m4, 2)) { - CLRBIT(_m[tile].m4, 2); - SETBIT(_m[tile].m4, 3); - } - // Clear possible junk data in PBS bits. - if (IsTileType(tile, MP_RAILWAY) && !HASBIT(_m[tile].m5, 7)) - SB(_m[tile].m4, 4, 4, 0); - } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); - } - /* From version 16.0, we included autorenew on engines, which are now saved, but * of course, we do need to initialize them for older savegames. */ if (CheckSavegameVersion(16)) { @@ -1328,6 +1314,37 @@ bool AfterLoadGame(void) UpdateAllWaypointCustomGraphics(); } + /* From version 15, we moved a semaphore bit from bit 2 to bit 3 in m4, making + * room for PBS. Now in version 21 move it back :P. */ + if (CheckSavegameVersion(21) && !CheckSavegameVersion(15)) { + BEGIN_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0) { + if (IsTileType(tile, MP_RAILWAY)) { + // Clear PBS signals, move back sempahore bit to 2 + if (HasSignals(tile)) { + // convert PBS signals to combo-signals + if (HASBIT(_m[tile].m4, 2)) SB(_m[tile].m4, 0, 2, 3); + + SB(_m[tile].m4, 2, 2, HASBIT(_m[tile].m4, 3)); + CLRBIT(_m[tile].m4, 3); + } + + // Clear PBS reservation on track + if (!IsTileDepotType(tile, TRANSPORT_RAIL)) + SB(_m[tile].m4, 4, 4, 0); + else + CLRBIT(_m[tile].m3, 6); + } + + // Clear PBS reservation on crossing + if (IsTileType(tile, MP_STREET) && IsLevelCrossing(tile)) + CLRBIT(_m[tile].m5, 0); + + // Clear PBS reservation on station + if (IsTileType(tile, MP_STATION) && IsLevelCrossing(tile)) + CLRBIT(_m[tile].m3, 6); + } END_TILE_LOOP(tile, MapSizeX(), MapSizeY(), 0); + } + FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index); return true; |