From: Mikko Rasa Date: Thu, 5 Feb 2015 16:03:25 +0000 (+0200) Subject: Improve metrics_stale flag handling X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e0508185b2b7d22ab955ba3baa641246b21aac5c;p=r2c2.git Improve metrics_stale flag handling --- diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index a1582fd..cef98ee 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -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()