chiark / gitweb /
wip
authorian <ian>
Sat, 12 Feb 2005 21:12:16 +0000 (21:12 +0000)
committerian <ian>
Sat, 12 Feb 2005 21:12:16 +0000 (21:12 +0000)
hostside/safety.c
hostside/safety.h

index a73bf2ef09aa27d79cbea3a2f628a95595663b71..59693002bfeef81f4fd0fc1272d6d09ffecef26c 100644 (file)
@@ -6,6 +6,14 @@
 
 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];
index 1825811dcf0331f5da759a182f3343d68df582f4..f552218a3a3c336dd3768abb5fb5c191b3bcc0d9 100644 (file)
@@ -10,14 +10,19 @@ typedef unsigned char Speed; /* non-negative, units of 4mm/s */
 
 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;
@@ -36,7 +41,7 @@ typedef struct {
 typedef struct {
   Speed maxspeed;
   int n_detections;
-  const Distance *detections;   /* incremental distances from front */
+  const Distance *detections; /* incremental distances from rear */
 } TrainInfo;