{
if(update_pending && !train.get_block_allocator().is_active())
update_route();
-
- if(current_row->type==DEPART)
- {
- const Clock &clock = train.get_layout().get_clock();
-
- Time::TimeDelta t = clock.get_current_time();
- if(t<current_row->time)
- t += Time::day;
-
- Time::TimeDelta b = t-dt*clock.get_rate();
- if(b<current_row->time)
- {
- train.ai_message(Message("set-target-speed", train.get_maximum_speed()));
- ++current_row;
- }
- }
}
void Timetable::save(list<DataFile::Statement> &st) const
dt += Time::day;
train.ai_message(Message("set-trip-duration", dt/clock.get_rate()));
}
+
+ late_arrival = false;
}
void Timetable::event(TrainAI &, const Message &msg)
{
- if(msg.type=="arrived")
+ if(msg.type=="departed")
+ {
+ if(current_row->type==DEPART)
+ ++current_row;
+ }
+ else if(msg.type=="arrived")
{
if(current_row->type==ARRIVE)
record_time();
if(delay<Time::zero)
{
duration = max(duration+delay, Time::zero);
+ train.ai_message(Message("set-target-speed", train.get_maximum_speed()));
+ signal_departed.emit();
+ signal_event.emit(Message("departed"));
delay = Time::zero;
}
}
public:
sigc::signal<void, const Route *> signal_route_changed;
+ sigc::signal<void> signal_departed;
sigc::signal<void, const TrackChain *> signal_arrived;
sigc::signal<void, const TrackChain *> signal_waypoint_reached;