t->seg->tr_backwards= t->backwards;
t->seg->resfin_done= 1;
- if (!t->seg->res_detect) { u->extraspace= 0; return -1; }
+ if (!t->seg->res_detect) {
+ u->train->plan_lookahead_nsegs= 1;
+ u->extraspace= 0;
+ return -1;
+ }
u->train->foredetect= t->seg;
return 0;
}
t.backwards= t.seg->tr_backwards ^ tra->backwards;
tra->backwards= 0;
+ tra->plan_lookahead_nsegs= 0;
tc.distance= TL_DIST_INF;
tc.nextseg= findhead_nextseg;
walk_compute_polarise:1, /* nose_nextseg still needs to worry */
need_polarise:1, /* when we commit */
train_polarity_inverted:1, /* right now, or if know_best, the best */
- know_best_polarity:1; /* longest-lasting into the future */
+ know_best_polarity:1, /* longest-lasting into the future */
+ done_fdet:1; /* for report_nextseg */
TrackLocation nose, fdet, tail;
TrackAdvanceContext nosec, tailc, fdetc;
TimeInterval elapsed; /* from now, minimum */
char flags[6];
int r;
- if (!u->usecurrentposn) /* we've had foredetect */
+ if (u->done_fdet) /* we've had foredetect */
if (++u->lookahead > u->train->plan_lookahead_nsegs)
return -1;
if (t->seg == u->train->foredetect) {
strcat(flags,"!");
u->usecurrentposn= 0;
+ u->done_fdet= 1;
}
ouprintf(" %s%s", t->backwards?"-":"", t->seg->i->pname);
u.train= tra;
u.hindmost= 0;
u.usecurrentposn= !always_use_motions;
+ u.done_fdet= 0;
/* Walk along the train printing its segments: */
ouprintf("train %s has", tra->pname);