(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.
This commit is contained in:
hackykid
2005-07-04 14:58:55 +00:00
parent d07e1a875e
commit ab9c6f126d
30 changed files with 1051 additions and 77 deletions

25
rail.h
View File

@@ -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
@@ -316,6 +322,15 @@ static inline Trackdir TrackExitdirToTrackdir(Track track, DiagDirection diagdir
return _track_exitdir_to_trackdir[track][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); }