chiark / gitweb /
wip; before get rid of all separate detections
authorian <ian>
Sun, 13 Feb 2005 11:32:19 +0000 (11:32 +0000)
committerian <ian>
Sun, 13 Feb 2005 11:32:19 +0000 (11:32 +0000)
hostside/safety.c

index 59693002bfeef81f4fd0fc1272d6d09ffecef26c..d0f51c93e150650123f8aeaf9d5615956b9809b2 100644 (file)
@@ -6,17 +6,25 @@
 
 State safety_actual;
 
-typedef struct TrackFollow TrackFollow;
-struct TrackFollow {
+typedef struct TrackLocation TrackLocation;
+struct TrackLocation {
+  SegmentIx segi; /* current segment */
+  Distance into; /* distance from start of segment */
+  unsigned backwards:1; /* if 1, into is positive and measured from end */
 };
 
-void trackfollow_begin(TrackFollow*, SegmentIx begin, unsigned backwards,
-                      Distance);
+void trackfollow_further(TrackLocation *tloc, Distance *remain_io);
+  /* Advances tloc, decrementing *remain_io, until either
+   * *remain_io becomes zero, or tloc->segi changes. */
 
 void safety_train_changed(TrainIx trai) {
   State *s = &safety_actual;
   TrainState *tra = s->tras[trai];
+  TrackLocation tloc;
+
+  tloc.segi= tra->foredetect;
+  tloc.into= tra->justarrived ? JUSTARRIVED_DIST : 
+
 
   for (segi = 
 s->trais[trai]