delay = Time::zero;
}
- if(destination_changed)
+ if(destination_changed && !planner)
+ start_planning(train.get_layout());
+
+ if(planner && planner->get_result()!=TrainRoutePlanner::PENDING)
{
- if(!planner)
- start_planning(train.get_layout());
- else if(planner->get_result()!=TrainRoutePlanner::PENDING)
+ destination_changed = false;
+ if(planner->get_result()==TrainRoutePlanner::COMPLETE)
{
- destination_changed = false;
- if(planner->get_result()==TrainRoutePlanner::COMPLETE)
- {
- const list<Route *> &planned_routes = planner->get_routes_for(train);
- routes.clear();
- routes.push_back(create_lead_route(0, planned_routes.front()));
- routes.insert(routes.end(), planned_routes.begin(), planned_routes.end());
- sequence_points = planner->get_sequence_for(train);
- current_sequence = 0;
- sequence_check_pending = false;
-
- route_changed();
- }
- planner = 0;
+ const list<Route *> &planned_routes = planner->get_routes_for(train);
+ routes.clear();
+ routes.push_back(create_lead_route(0, planned_routes.front()));
+ routes.insert(routes.end(), planned_routes.begin(), planned_routes.end());
+ sequence_points = planner->get_sequence_for(train);
+ current_sequence = 0;
+ sequence_check_pending = false;
+
+ route_changed();
}
+ planner = 0;
}
if(sequence_check_pending)