From: Mikko Rasa Date: Fri, 11 Apr 2014 19:59:16 +0000 (+0300) Subject: Don't pick a route that doesn't know how to set the turnout X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c435f10d8de8a4058c43bcfc6c7073c8a8798463;p=r2c2.git Don't pick a route that doesn't know how to set the turnout --- diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index a6a47c0..9a86263 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -371,10 +371,15 @@ Route *TrainRouter::create_lead_route(Route *lead, const Route *target) bool TrainRouter::advance_route(RouteList::iterator &iter, const Block &block) { const set &tracks = block.get_tracks(); + unsigned turnout_addr = block.get_turnout_address(); for(; iter!=routes.end(); ++iter) + { + if(turnout_addr && (*iter)->get_turnout(turnout_addr)<0) + continue; for(set::const_iterator j=tracks.begin(); j!=tracks.end(); ++j) if((*iter)->has_track(**j)) return true; + } return false; }