]> git.tdb.fi Git - r2c2.git/commitdiff
Don't pick a route that doesn't know how to set the turnout
authorMikko Rasa <tdb@tdb.fi>
Fri, 11 Apr 2014 19:59:16 +0000 (22:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 11 Apr 2014 19:59:16 +0000 (22:59 +0300)
source/libr2c2/trainrouter.cpp

index a6a47c0b5b13a291e30096795c87d2f8c1908628..9a86263b9bec5922fa58d8201529731e79c01944 100644 (file)
@@ -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<Track *> &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<Track *>::const_iterator j=tracks.begin(); j!=tracks.end(); ++j)
                        if((*iter)->has_track(**j))
                                return true;
+       }
 
        return false;
 }