summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authorhackykid <hackykid@openttd.org>2005-07-04 14:58:55 +0000
committerhackykid <hackykid@openttd.org>2005-07-04 14:58:55 +0000
commit60ddaf95f0b52a09fad18ea05b2b9db4509d0511 (patch)
treec0f8f7ba8535ff0f5e9fd8581b36c737ac10e0b1 /station_cmd.c
parentb872cf7f7bd6fdcc8b09903130cb961c004ad5de (diff)
downloadopenttd-60ddaf95f0b52a09fad18ea05b2b9db4509d0511.tar.xz
(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.
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/station_cmd.c b/station_cmd.c
index 9e5e6ffc4..edc9ccdfa 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -19,6 +19,7 @@
#include "airport.h"
#include "sprite.h"
#include "depot.h"
+#include "pbs.h"
enum {
/* Max stations: 64000 (64 * 1000) */
@@ -2120,6 +2121,7 @@ static void DrawTile_Station(TileInfo *ti)
const DrawTileSeqStruct *dtss;
const DrawTileSprites *t = NULL;
byte railtype = _map3_lo[ti->tile] & 0xF;
+ int type_offset;
uint32 relocation = 0;
{
@@ -2154,15 +2156,27 @@ static void DrawTile_Station(TileInfo *ti)
if (image & 0x8000)
image |= image_or_modificator;
+ // For custom sprites, there's no railtype-based pitching.
+ type_offset = railtype * ((image & 0x3FFF) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1);
+
// station_land array has been increased from 82 elements to 114
// but this is something else. If AI builds station with 114 it looks all weird
- image += railtype * ((image & 0x3FFF) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 1);
+ image += type_offset;
DrawGroundSprite(image);
+ if (_debug_pbs_level >= 1) {
+ byte pbs = PBSTileReserved(ti->tile);
+ if (pbs & TRACK_BIT_DIAG1) DrawGroundSprite((0x3ED + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_DIAG2) DrawGroundSprite((0x3EE + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_UPPER) DrawGroundSprite((0x3EF + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_LOWER) DrawGroundSprite((0x3F0 + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_LEFT) DrawGroundSprite((0x3F2 + type_offset) | PALETTE_CRASH);
+ if (pbs & TRACK_BIT_RIGHT) DrawGroundSprite((0x3F1 + type_offset) | PALETTE_CRASH);
+ }
+
foreach_draw_tile_seq(dtss, t->seq) {
- image = dtss->image + relocation;
- // For custom sprites, there's no railtype-based pitching.
- image += railtype * ((image & 0x3FFF) < _custom_sprites_base ? TRACKTYPE_SPRITE_PITCH : 0);
+ image = dtss->image + relocation;
+ image += type_offset;
if (_display_opt & DO_TRANS_BUILDINGS) {
image = (image & 0x3FFF) | 0x03224000;
} else {