6 typedef unsigned short TrainNum;
7 typedef unsigned short SegmentNum;
8 typedef unsigned short LocationNum;
9 typedef short TimeInterval;
10 typedef short Distance;
11 typedef char Speed; /* non-negative, units of 4mm/s */
14 SegmentNum foredetect; /* train's detectable part is at most maxinto */
15 Distance maxinto, uncertainty; /* into foredetect but train may be */
16 unsigned /* uncertainty less far advanced */
17 backwards:1; /* train is moving backwards wrt its own front and back */
23 owned:1, /* this track segment is reserved for a train */
24 tr_backwards:1, /* train's motion is (would be) backwards wrt track */
25 pt_sideways:1, /* points are set to `alternative'. (no points?: 0) */
26 pt_moving:1, /* points have been told to change, sideways is new state */
27 autostop:1, /* owning train is slow and wants to stop on detection */
28 tr_updated:1; /* for use by safety_train_changed etc.; otherwise 0 */
29 TimeInterval until_here, /* ) nonnegative; */ /* ) always valid but */
30 until_detect; /* ) 0 if already */ /* ) only meaningful */
31 TrainNum owner; /* ) iff owned */
36 unsigned next_backwards:1;
42 SegmentLink backwards, forwards, sideways;
47 Distance tail, detectable, head;
50 extern const TrainInfo info_train[NUM_TRAINS];
51 extern const SegmentInfo info_segment[NUM_SEGMENTS];
54 TrainState tras[NUM_TRAINS];
55 SegmentState segs[NUM_SEGMENTS];