From de7380fdde172fa7e905e8af91d5842994faa9fb Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 12 Apr 2014 22:29:23 +0300 Subject: [PATCH] Use set_route for the first route --- source/libr2c2/trainrouteplanner.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/libr2c2/trainrouteplanner.cpp b/source/libr2c2/trainrouteplanner.cpp index be335d2..581bd03 100644 --- a/source/libr2c2/trainrouteplanner.cpp +++ b/source/libr2c2/trainrouteplanner.cpp @@ -108,7 +108,13 @@ void TrainRoutePlanner::create_routes(const RoutingStep &goal) for(vector::iterator i=routed_trains.begin(); i!=routed_trains.end(); ++i) { for(list::iterator j=i->routes.begin(); j!=i->routes.end(); ++j) - i->router->add_route(**j); + { + if(j==i->routes.begin()) + i->router->set_route(*j); + else + i->router->add_route(**j); + } + const TrainRoutingState *current_wait = 0; for(list::const_iterator j=i->waits.begin(); j!=i->waits.end(); ++j) if(!current_wait || (*j)->track.track()!=current_wait->track.track()) -- 2.45.2