- else if(i->type==THROUGH)
- train.ai_message(Message("add-waypoint", i->target));
+ else
+ {
+ train.ai_message(Message("add-waypoint", TrainRouter::Waypoint(*i->target, i->direction)));
+ if(i->type==ARRIVE)
+ break;
+ }
+ }
+
+ list<Row>::iterator next_depart = find_trip(arrive, 0);
+ if(next_depart==rows.end())
+ next_depart = find_trip(rows.begin(), 0);
+ if(next_depart!=rows.end())
+ {
+ Time::TimeDelta dt = next_depart->time-depart->time;
+ while(dt<=Time::zero)
+ dt += Time::day;
+ train.ai_message(Message("set-trip-duration", dt/clock.get_rate()));