From: Mikko Rasa Date: Sat, 12 Apr 2014 19:29:23 +0000 (+0300) Subject: Use set_route for the first route X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=de7380fdde172fa7e905e8af91d5842994faa9fb;p=r2c2.git Use set_route for the first route --- 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())