State safety_actual;
+typedef struct TrackFollow TrackFollow;
+struct TrackFollow {
+};
+
+void trackfollow_begin(TrackFollow*, SegmentIx begin, unsigned backwards,
+ Distance);
+
+
void safety_train_changed(TrainIx trai) {
State *s = &safety_actual;
TrainState *tra = s->tras[trai];
typedef struct {
SegmentIx foredetect;
- unsigned justarrived:1, reverse:1;
+ unsigned
+ justarrived:1, /* is stopped just after triggering foredetect segment */
+ reverse:1; /* train is moving backwards wrt its own front and back */
Speed speed;
} TrainState;
typedef struct {
- unsigned present_now:1, present_future:1,
- detectable_now:1, detectable_future:1,
- sideways:1, autostop:1;
+ unsigned
+ present_now:1, present_future:1, /* owning train is or will use space */
+ detectable_now:1, detectable_future:1, /* owning train draws current */
+ reverse:1, /* owning train's motion is (would be) backwards wrt track */
+ sideways:1, /* for segment with points, points are set to `alternative' */
+ autostop:1; /* owning train is slow and should stop on detection */
TrainIx owner;
/*polarity?*/
} SegmentState;
typedef struct {
Speed maxspeed;
int n_detections;
- const Distance *detections; /* incremental distances from front */
+ const Distance *detections; /* incremental distances from rear */
} TrainInfo;