From 7d261934d68de7d5a19e84ec7a228e9f55754675 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 27 Jul 2008 15:17:15 +0000 Subject: [PATCH] Do not increment lookahead before !!done_fdet (!) --- hostside/safety.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hostside/safety.c b/hostside/safety.c index 14f4704..95ef1ad 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -281,7 +281,7 @@ typedef struct { double maxspeed; Segment *hindmost, *furthest, *desire_move; int desire_movposcomb; - int lookahead; + int lookahead, reportcount; PredictionProblemCallback *problem_callback; void *problem_callback_u; @@ -1021,14 +1021,14 @@ static int report_nextseg(TrackLocation *t, struct TrackAdvanceContext *c, char flags[6]; int r; - u->lookahead++; - if (u->lookahead > NUM_SEGMENTS * 2) { + u->reportcount++; + if (u->reportcount > NUM_SEGMENTS * 2) { ouprintf(" [... infinite loop!]\n"); abort(); } if (u->done_fdet) /* we've had foredetect */ - if (u->lookahead > u->train->plan_lookahead_nsegs) + if (++u->lookahead > u->train->plan_lookahead_nsegs) return -1; flags[0]= 0; -- 2.30.2