From 60ddaf95f0b52a09fad18ea05b2b9db4509d0511 Mon Sep 17 00:00:00 2001 From: hackykid Date: Mon, 4 Jul 2005 14:58:55 +0000 Subject: (svn r2516) - Feature: [pbs] Implement path-based-signalling. This allows multiple trains within the same signal block, provided their paths dont intersect. For this the block must have all exit and entry signals be pbs signals. Place these by ctrl-clicking 4 times on a normal signal. - Feature: [pbs] Implement autoplacement of pbs blocks, when a block has an entry and an exit pbs signal, covert the entire block to pbs. Can be turned off in the patch settings. - Feature: [pbs] Allow showing of reserved status by making the tracks darker, when the pbs debug level is at least 1. --- tunnelbridge_cmd.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tunnelbridge_cmd.c') diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c index 36924686c..0ae9bb5c6 100644 --- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -10,6 +10,8 @@ #include "player.h" #include "town.h" #include "sound.h" +#include "pbs.h" +#include "debug.h" extern void DrawCanalWater(TileIndex tile); @@ -770,6 +772,7 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) byte m5; uint c = tile; uint16 new_data; + byte pbs; //checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until // you have a "Poor" (0) town rating @@ -778,6 +781,7 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) do { m5 = _map5[c]; + pbs = PBSTileReserved(c); if (m5 & 0x40) { if (m5 & 0x20) { @@ -791,6 +795,9 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags) SetTileType(c, new_data >> 12); _map5[c] = (byte)new_data; _map2[c] = 0; + _map3_hi[c] &= 0x0F; + if (direction ? HASBIT(pbs,0) : HASBIT(pbs,1)) + PBSReserveTrack(c, direction ? 0 : 1); MarkTileDirtyByTile(c); @@ -1144,6 +1151,16 @@ static void DrawTile_TunnelBridge(TileInfo *ti) } } } + + if (_debug_pbs_level >= 1) { + byte pbs = PBSTileReserved(ti->tile); + if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite(0x3ED | PALETTE_CRASH); + if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite(0x3EE | PALETTE_CRASH); + if (pbs & TRACK_BIT_UPPER) DrawGroundSprite(0x3EF | PALETTE_CRASH); + if (pbs & TRACK_BIT_LOWER) DrawGroundSprite(0x3F0 | PALETTE_CRASH); + if (pbs & TRACK_BIT_LEFT) DrawGroundSprite(0x3F2 | PALETTE_CRASH); + if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite(0x3F1 | PALETTE_CRASH); + } } static uint GetSlopeZ_TunnelBridge(TileInfo *ti) { @@ -1426,6 +1443,8 @@ static uint32 VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y return 0; } if (fc == _tunnel_fractcoord_2[dir]) { + if (v->next == NULL) + PBSClearTrack(v->tile, FIND_FIRST_BIT(v->u.rail.track)); v->tile = tile; v->u.rail.track = 0x40; v->vehstatus |= VS_HIDDEN; -- cgit v1.2.3-54-g00ecf