chiark / gitweb /
get report management of fdet_done right
authorian <ian>
Sun, 8 Jun 2008 19:33:34 +0000 (19:33 +0000)
committerian <ian>
Sun, 8 Jun 2008 19:33:34 +0000 (19:33 +0000)
hostside/safety.c

index 0f2500f14ef1025001b26e48381d2f7529b799d0..a5b85045d078227e8d3bafdaf4902a9e23c07d7d 100644 (file)
@@ -979,6 +979,9 @@ void report_train_position(Train *tra) {
 static int report_getmovpos(TrackLocation *t, TrackAdvanceContext *c,
                            MovPosComb *use_io) {
   PredictUserContext *u= c->u;
+  if (u->done_fdet && t->seg != u->train->foredetect)
+    /* we must use current posn for foredetect itself */
+    u->usecurrentposn= 0;
   if (!u->usecurrentposn && t->seg->motion)
     *use_io= movpos_change_intent(t->seg->motion);
   assert(*use_io>=0);
@@ -1001,9 +1004,8 @@ static int report_nextseg(TrackLocation *t, struct TrackAdvanceContext *c,
     strcat(flags,"*");
   if (t->seg->det_ignore)
     strcat(flags,".");
-  if (t->seg == u->train->foredetect) {
+  if (t->seg == u->train->foredetect && !u->done_fdet) {
     strcat(flags,"!");
-    u->usecurrentposn= 0;
     u->done_fdet= 1;
   }