From 175f35014bc922361efa36225304e7b50e72583c Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 13 Feb 2005 11:32:19 +0000 Subject: [PATCH] wip; before get rid of all separate detections --- hostside/safety.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hostside/safety.c b/hostside/safety.c index 5969300..d0f51c9 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -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] -- 2.30.2