U< resolving <some message about resolution algorithm>
U< resolution inexplicable <segment>
- U< resolution mispositioned <train> <crush-ending-segment> <distance>
+ U< resolution mispositioned head|tail <train> <crush-ending-seg> <distance>
U< resolution movpos-change-failed <segment>/<poscombname>
U< resolution problems <number-of-problems>
static void ends_callback_debug(const char *what, TrackLocation *t,
struct TrackAdvanceContext *c) {
oprintf(DUPO("resolving") " ends %s"
- " %s%s det=%d ours=%d done=%d owner=%s home=%s\n",
- what, t->backwards?"-":"", t->seg->i->pname,
+ " %s%s dist=%d det=%d ours=%d done=%d owner=%s home=%s\n",
+ what, t->backwards?"-":"", t->seg->i->pname, c->distance,
t->seg->res_detect,
t->seg->resfin_ours,
t->seg->resfin_done,
segdist(tra->foredetect));
tra->maxinto= segdist(tra->foredetect) - u.extraspace;
- if (tra->maxinto < 0) tra->maxinto= 0;
+ if (tra->maxinto < 0) {
+ oprintf(UPO, "resolution mispositioned head %s %s -%d\n",
+ tra->pname, tra->foredetect->i->pname, -tra->maxinto);
+ return 1;
+ }
tra->uncertainty= tra->maxinto;
FOR_SEG seg->resfin_done= 0;
t.seg= tra->foredetect;
- t.remain= segdist(tra->foredetect) - u.extraspace;
+ t.remain= 0;
t.backwards= !tra->foredetect->tr_backwards;
tc.distance= tra->detectable + tra->tail + MARGIN_NOSE;
if (tc.distance) {
tra->uncertainty -= tc.distance;
if (tra->uncertainty < 0) {
- oprintf(UPO, "resolution mispositioned %s %s -%d\n",
+ oprintf(UPO, "resolution mispositioned tail %s %s -%d\n",
tra->pname, t.seg->i->pname, -tra->uncertainty);
return 1;
}
/*---------- prediction entrypoint ----------*/
-ErrorCode predict_confirm(Train *tra, int accelerate,
- PredictionProblemCallback *ppc, void *ppcu) {
+ErrorCode predict(Train *tra, int accelerate,
+ PredictionProblemCallback *ppc, void *ppcu) {
PredictUserContext u;
Segment *foredet;
SEG_IV;
report_train_position(tra);
- ec= predict_confirm(tra, 0, detection_report_problem, 0);
+ ec= predict(tra, 0, detection_report_problem, 0);
if (!ec) return;
assert(ec == EC_SignallingPredictedProblem);
PredictionProblemCallback *ppc, void *ppcu);
/* If this check success, caller may call movpos_change */
-ErrorCode predict_confirm(Train *tra, int accelerate,
- PredictionProblemCallback *ppc, void *ppcu);
+ErrorCode predict(Train *tra, int accelerate,
+ PredictionProblemCallback *ppc, void *ppcu);
/* Lower-level interface for speedmanager etc.
* Caller must call this with different situations until it succeeds!
* Caller may pass ppc=0 and ppcu=(char*)"some context" to
tra->speed.decel.duration= stop_info(tra,vnow)->ts;
toev_start(&tra->speed.decel);
tra->speed.speed= vnow;
- ec= predict_confirm(tra,0, 0,(char*)"deceleration forbidden");
+ ec= predict(tra,0, 0,(char*)"deceleration forbidden");
assert(!ec);
xmit(tra);
return 0;
}
tra->speed.try_speed= vtarg;
- ec= predict_confirm(tra,1, ppc,ppcu);
+ ec= predict(tra,1, ppc,ppcu);
if (ec) {
tra->speed.try_speed= -1;
- ec2= predict_confirm(tra,1, 0,(char*)"abandoned acceleration");
+ ec2= predict(tra,1, 0,(char*)"abandoned acceleration");
assert(!ec2);
return ec;
}