From: ian Date: Sat, 24 May 2008 01:55:16 +0000 (+0000) Subject: do not confuse ourselves if new plan includes existing moving motion X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=867bd64a1cf85f36c80c78e637c4d4f274860427;p=trains.git do not confuse ourselves if new plan includes existing moving motion --- diff --git a/hostside/safety.c b/hostside/safety.c index 6b9ca79..289fac3 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -893,12 +893,15 @@ ErrorCode predict(Train *tra, struct timeval tnow, unsigned flags, /* install the new plan, if any */ if (seg->motion_newplan) { - if (!seg->now_present) { + if (seg->motion_newplan == seg->motion) { + /* excellent, already doing it */ + } else if (!seg->now_present) { MovPosComb target= movpos_change_intent(seg->motion_newplan); ec= movpos_change(seg, target, -1, seg->motion_newplan); assert(!ec); /* motion is updated by movpos_change */ } else { + /* we'll do it later, then */ seg->motion= seg->motion_newplan; } seg->motion_newplan= 0;