6 typedef unsigned short TrainNum;
7 typedef unsigned short SegmentNum;
8 typedef unsigned short LocationNum;
9 typedef short Distance;
10 typedef char Speed; /* non-negative, units of 4mm/s */
13 SegmentNum foredetect;
15 justarrived:1, /* is stopped just after triggering foredetect segment */
16 backwards:1; /* train is moving backwards wrt its own front and back */
22 tr_detect_now:1, tr_detect_future:1, /* owning train draws current */
23 tr_here_now:1, tr_here_future:1, /* owning train is or will use space */
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 tr_autostop:1, /* owning train is slow and wants to stop on detection */
27 tr_updated:1; /* for use by safety_train_changed etc.; otherwise 0 */
29 TrainNum tran; /* always valid but only meaningful iff tr_here_future */
40 SegmentLink backwards, forwards, sideways;
45 Distance tail, detectable, head;
48 extern const TrainInfo info_train[NUM_TRAINS];
49 extern const SegmentInfo info_segment[NUM_SEGMENTS];
52 TrainState tras[NUM_TRAINS];
53 SegmentState segs[NUM_SEGMENTS];