u.fdetc.trackend= pred_trackend;
u.tailc.nextseg= tail_nextseg;
- if ((flags & PREDF_JUSTDET) && u.stopping) {
+ if (!u.stopping) {
+ /* we're carrying on until the next segment */
+ u.fdetc.distance= u.fdet.remain;
+ } else if (flags & PREDF_JUSTDET) {
/* we actually know exactly where we are */
- u.fdetc.distance= u.stopping_distance;
- } else {
- u.fdetc.distance= tra->uncertainty + u.stopping_distance;
- u.elapsed= -tra->uncertainty / u.maxspeed;
+ u.fdetc.distance= 0;
+ } else { /* stopping, but we're mid-segment */
+ u.fdetc.distance= tra->uncertainty;
}
- u.fdetc.distance += MARGIN_NOSE;
+ u.elapsed= -u.fdetc.distance / u.maxspeed; /* imagine we're already there */
+ u.fdetc.distance += u.stopping_distance + MARGIN_NOSE;
u.was_distance= u.fdetc.distance;
ec= trackloc_advance(&u.fdet,&u.fdetc);