summaryrefslogtreecommitdiff
path: root/rail.h
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 /rail.h
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 'rail.h')
-rw-r--r--rail.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/rail.h b/rail.h
index 323e0f983..d8611787e 100644
--- a/rail.h
+++ b/rail.h
@@ -43,8 +43,9 @@ typedef enum SignalTypes {
SIGTYPE_ENTRY = 1, // presignal block entry
SIGTYPE_EXIT = 2, // presignal block exit
SIGTYPE_COMBO = 3, // presignal inter-block
+ SIGTYPE_PBS = 4, // pbs signal
SIGTYPE_END,
- SIGTYPE_MASK = 3,
+ SIGTYPE_MASK = 7,
} SignalType;
typedef enum RailTypes {
@@ -134,6 +135,11 @@ typedef enum SignalStates {
SIGNAL_STATE_GREEN = 1,
} SignalState;
+// these are the maximums used for updating signal blocks, and checking if a depot is in a pbs block
+enum {
+ NUM_SSD_ENTRY = 256, // max amount of blocks
+ NUM_SSD_STACK = 32 ,// max amount of blocks to check recursively
+};
/**
* Maps a Trackdir to the corresponding TrackdirBits value
@@ -317,6 +323,15 @@ static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir
}
/**
+ * Maps a track and an (4-way) dir to the trackdir that represents the track
+ * with the exit in the given direction.
+ */
+static inline Trackdir TrackEnterdirToTrackdir(Track track, DiagDirection diagdir) {
+ extern const Trackdir _track_enterdir_to_trackdir[TRACK_END][DIAGDIR_END];
+ return _track_enterdir_to_trackdir[track][diagdir];
+}
+
+/**
* Maps a track and a full (8-way) direction to the trackdir that represents
* the track running in the given direction.
*/
@@ -359,6 +374,14 @@ static inline DiagDirection ReverseDiagdir(DiagDirection diagdir) {
return _reverse_diagdir[diagdir];
}
+/**
+ * Maps a (8-way) direction to a (4-way) DiagDirection
+ */
+static inline DiagDirection DirToDiagdir(Direction dir) {
+ assert(dir < DIR_END);
+ return (DiagDirection)(dir >> 1);
+}
+
/* Checks if a given Track is diagonal */
static inline bool IsDiagonalTrack(Track track) { return (track == TRACK_DIAG1) || (track == TRACK_DIAG2); }