u.train= tra;
u.problem_callback= ppc;
u.problem_callback_u= ppcu;
- u.neednewplan= !!(flags & PREDF_NEWPLAN);
+ u.neednewplan= !(flags & PREDF_OLDPLAN);
u.maxspeed= speedmanager_speed_maxestimate(u.train, tnow);
- u.stopping= !(flags & PREDF_NEWPLAN) && speedmanager_stopping(u.train);
+ u.stopping= (flags & PREDF_OLDPLAN) && speedmanager_stopping(u.train);
u.stopping_distance= speedmanager_stoppingdistance(u.train, tnow);
u.desire_move= desire_move;
tra->speed.decel.running ? " decel" : "",
u.stopping_distance,
"-j"[ !!(flags & PREDF_JUSTDET) ],
- "-n"[ !!(flags & PREDF_NEWPLAN) ],
+ "no"[ !!(flags & PREDF_OLDPLAN) ],
u.stopping ? " stopping" : "",
u.desire_move ? u.desire_move->i->pname : "",
u.desire_move ? u.desire_move->i->poscombs[u.desire_movposcomb]
tra->backwards ^= 1;
newfdet.seg->tr_backwards ^= 1; /* in case it's the same as oldfdet */
- ec2= predict(tra,tnow, 0,0,0, 0,(char*)"abandon reverse");
+ ec2= predict(tra,tnow, PREDF_OLDPLAN,0,0, 0,(char*)"abandon reverse");
assert(!ec2);
return ec;
tra->plan_lookahead_nsegs--;
report_train_position(tra);
- ec= predict(tra,tnow, PREDF_JUSTDET,0,0, detection_report_problem,0);
+ ec= predict(tra,tnow, PREDF_JUSTDET|PREDF_OLDPLAN,0,0,
+ detection_report_problem,0);
if (!ec) return;
assert(ec == EC_SignallingPredictedProblem);
report_train_position(tra);
speedmanager_safety_stop(tra,tnow);
- ec= predict(tra,tnow, PREDF_JUSTDET,0,0, 0,(char*)"safety commanding stop");
+ ec= predict(tra,tnow, PREDF_JUSTDET|PREDF_OLDPLAN,0,0,
+ 0,(char*)"safety commanding stop");
assert(!ec);
}
ec= predict(seg->owner,tnow, PREDF_NEWPLAN,seg,comb, ppc,ppcu);
if (!ec) return 0;
- ec2= predict(seg->owner,tnow,0, 0,0, 0,(char*)"abandon movposchange");
+ ec2= predict(seg->owner,tnow, PREDF_OLDPLAN, 0,0,
+ 0,(char*)"abandon movposchange");
assert(!ec2);
return ec;
#define PREDF_JUSTDET 001u
/* we have just detected the train entering its foredetect so we
* can subtract the uncertainty from the stopping distance */
-#define PREDF_NEWPLAN 002u
- /* the existing plan is not necessarily sufficient as
- * we are intending to accelerate or change a movpos */
+#define PREDF_OLDPLAN 002u
+ /* the old plan is necessarily sufficient as we are not intending
+ * to accelerate, change a movpos, etc. */
+#define PREDF_NEWPLAN 000u /* now the default */
ErrorCode predict(Train *tra, struct timeval tnow, unsigned flags,
Segment *desire_move, int desire_movposcomb,
toev_start(&tra->speed.decel);
tra->speed.speed= vnow;
if (ppc || ppcu) {
- ec= predict(tra,tnow, 0,0,0, 0,(char*)"deceleration forbidden");
+ ec= predict(tra,tnow, PREDF_OLDPLAN,0,0,
+ 0,(char*)"deceleration forbidden");
assert(!ec);
}
xmit(tra);
if (ec) {
tra->speed.try_speed= -1;
- ec2= predict(tra,tnow, 0,0,0, 0,(char*)"abandoned acceleration");
+ ec2= predict(tra,tnow, PREDF_OLDPLAN,0,0,
+ 0,(char*)"abandoned acceleration");
assert(!ec2);
return ec;
}