+#include "driver.h"
#include "layout.h"
#include "route.h"
#include "trackiter.h"
void TrainRouter::tick(const Time::TimeDelta &dt)
{
- if(delay)
- {
- delay -= dt;
- if(delay<Time::zero)
- {
- duration = max(duration+delay, Time::zero);
- delay = Time::zero;
- }
- }
- else if(duration)
- duration = max(duration-dt, Time::zero);
-
if(waypoints_changed && !planner)
start_planning(train.get_layout());
if(planner && planner->check()!=TrainRoutePlanner::PENDING)
apply_plan(train.get_layout(), *planner);
+ if(!train.get_layout().get_driver().is_halted())
+ {
+ if(delay)
+ {
+ delay -= dt;
+ if(delay<Time::zero)
+ {
+ duration = max(duration+delay, Time::zero);
+ delay = Time::zero;
+ }
+ }
+ else if(duration)
+ duration = max(duration-dt, Time::zero);
+ }
+
if(sequence_check_pending)
{
if(sequence_points.front().is_cleared())