+void TrainRoutePlanner::prepare_plan()
+{
+ steps.clear();
+ queue.clear();
+ goal = 0;
+ result = PENDING;
+
+ queue.push_back(RoutingStep());
+ RoutingStep &start = queue.back();
+ for(vector<TrainRoutingInfo>::iterator i=routed_trains.begin(); i!=routed_trains.end(); ++i)
+ start.trains.push_back(TrainRoutingState(*i));
+ start.update_estimate();
+}
+
+void TrainRoutePlanner::create_plan()
+{
+ while(!queue.empty())
+ {
+ const RoutingStep &step = get_step();
+ if(step.is_goal())
+ {
+ goal = &step;
+ return;
+ }
+
+ add_steps(step);
+ }
+
+ result = FAILED;
+}
+