From c435f10d8de8a4058c43bcfc6c7073c8a8798463 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 11 Apr 2014 22:59:16 +0300 Subject: [PATCH] Don't pick a route that doesn't know how to set the turnout --- source/libr2c2/trainrouter.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.45.2