- int r = get_turnout(tid);
- if(r>=0)
- {
- // Linking to a turnout with path set is only good if we're continuing that path
- if(endpoints[epi].paths&(1<<r))
- result |= 2;
- }
- else
- {
- // Linked to a turnout with no path set - find out other linked tracks
- unsigned count = 0;
- const vector<Track *> &links = (*i)->get_links();
- int epj = -1;
- for(unsigned k=0; k<endpoints.size(); ++k)
- if(tracks.count(links[k]))
+ // Linking to a turnout with path set is only good if we're continuing that path
+ if(ep.paths&(1<<path))
+ result |= 2;
+ }
+ else
+ {
+ // Linked to a turnout with no path set - check other linked tracks
+ const vector<Track *> &tlinks = (*i)->get_links();
+ unsigned count = 0;
+ for(unsigned j=0; j<tlinks.size(); ++j)
+ if(tracks.count(tlinks[j]))
+ {
+ unsigned tid2 = tlinks[j]->get_turnout_id();
+ if(tid2)