- unsigned exit = last->block->traverse(last->entry);
- Track *track = last->block->get_endpoints()[exit].track;
- if(route->get_tracks().count(track))
- cur_route = route;
- else if(next_route && next_route->get_tracks().count(track))
- cur_route = next_route;
+ const set<Track *> &tracks = last->block->get_tracks();
+ for(set<Track *>::const_iterator i=tracks.begin(); (cur_route!=route && i!=tracks.end()); ++i)
+ {
+ if(route->get_tracks().count(*i))
+ cur_route = route;
+ else if(next_route && next_route->get_tracks().count(*i))
+ cur_route = next_route;
+ }