]> git.tdb.fi Git - r2c2.git/commitdiff
Use set_route for the first route
authorMikko Rasa <tdb@tdb.fi>
Sat, 12 Apr 2014 19:29:23 +0000 (22:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 12 Apr 2014 19:30:42 +0000 (22:30 +0300)
source/libr2c2/trainrouteplanner.cpp

index be335d27b669a708cfb3ae5708dcb22a6ef0836c..581bd03fa86f9b3786d0989f96e687130f459ac2 100644 (file)
@@ -108,7 +108,13 @@ void TrainRoutePlanner::create_routes(const RoutingStep &goal)
        for(vector<TrainRoutingInfo>::iterator i=routed_trains.begin(); i!=routed_trains.end(); ++i)
        {
                for(list<Route *>::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 TrainRoutingState *>::const_iterator j=i->waits.begin(); j!=i->waits.end(); ++j)
                        if(!current_wait || (*j)->track.track()!=current_wait->track.track())