From 9396ed329ad2490484c5bd8259755d8da7f668f6 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 4 May 2008 21:50:56 +0000 Subject: [PATCH] proper handling of tail-eating ownership --- hostside/safety.c | 11 ++++++++--- hostside/xs.gdb | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hostside/safety.c b/hostside/safety.c index 4ff02bf..859465d 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -592,10 +592,12 @@ static int report_nextseg(TrackLocation *t, struct TrackAdvanceContext *c, int r; if (t->seg->owner != u->train) return -1; - if (u->usecurrentposn && !t->seg->det_ignore) + if (t->seg == u->furthest) { /* We've gone back past our own tail into the place where our - * head is going to be in the far future. Confusing, eh ? */ + * head is going to be in the far future. */ + oprintf(UPO, " ..."); return -1; + } flags[0]= 0; @@ -627,7 +629,7 @@ void report_train_ownerships(Train *tra, Segment *furthest, memset(&u,0,sizeof(u)); u.train= tra; - u.furthest= furthest; + u.furthest= 0; u.usecurrentposn= 0; u.forceusemotions= force_use_motions; @@ -645,7 +647,10 @@ void report_train_ownerships(Train *tra, Segment *furthest, mpc= furthest->movposcomb; r= report_nextseg(&u.tail,&u.tailc,&mpc,0); assert(!r); + + u.furthest= furthest; trackloc_advance(&u.tail,&u.tailc); + oprintf(UPO, "\n"); } diff --git a/hostside/xs.gdb b/hostside/xs.gdb index 44c385f..c91a039 100644 --- a/hostside/xs.gdb +++ b/hostside/xs.gdb @@ -3,6 +3,7 @@ break vdie break nmra_errchk_fail break predict_problem break safety_panic +break obc_error #break findhead_nextseg set args -S+realtime.log shinkansen.speeds.record homes.record run -- 2.30.2