]> git.tdb.fi Git - r2c2.git/commitdiff
Improve metrics_stale flag handling
authorMikko Rasa <tdb@tdb.fi>
Thu, 5 Feb 2015 16:03:25 +0000 (18:03 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 5 Feb 2015 16:03:25 +0000 (18:03 +0200)
source/libr2c2/trainrouter.cpp

index a1582fd65c64920346c1566f3a161d46b4df6dc8..cef98eebbe46c3a5793579b168d970e4e6734957 100644 (file)
@@ -354,6 +354,7 @@ void TrainRouter::train_advanced(Block &block)
                                if(!wp.has_track(*t_iter))
                                {
                                        waypoints.erase(waypoints.begin());
+                                       metrics_stale = true;
                                        signal_waypoint_reached.emit(&wp);
                                        signal_event.emit(Message("waypoint-reached", &wp));
                                        break;
@@ -390,6 +391,8 @@ void TrainRouter::create_metrics()
                delete *i;
        metrics.clear();
 
+       metrics_stale = false;
+
        if(!destination)
                return;
 
@@ -399,8 +402,6 @@ void TrainRouter::create_metrics()
 
        for(unsigned i=metrics.size(); --i>0; )
                metrics[i]->chain_to(*metrics[(i+1)%metrics.size()]);
-
-       metrics_stale = false;
 }
 
 bool TrainRouter::create_lead_route()