}
const TrackType &type = lowest.track->get_type();
- const vector<Endpoint> &eps = type.get_endpoints();
+ const vector<TrackType::Endpoint> &eps = type.get_endpoints();
const vector<Track *> &links = lowest.track->get_links();
for(unsigned i=0; i<eps.size(); ++i)
{
}
}
- if(!final)
- throw InvalidParameterValue("Could not find a route");
-
list<Track *> result;
for(Node *node=final; node; node=node->prev)
result.push_front(node->track);
{
list<Track *> tracks = dijkstra(from, ep, goal);
+ if(tracks.empty())
+ return 0;
+
Route *route = new Route(from.get_layout());
for(list<Track *>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
route->add_track(**i);
{
found.insert(tid);
- const vector<Endpoint> &endpoints = (*i)->get_type().get_endpoints();
+ const vector<TrackType::Endpoint> &endpoints = (*i)->get_type().get_endpoints();
const vector<Track *> &links = (*i)->get_links();
// Build a combined path mask from linked endpoints
if(unsigned tid2 = links[j]->get_turnout_id())
{
- const Endpoint &ep = links[j]->get_type().get_endpoints()[links[j]->get_endpoint_by_link(**i)];
+ const TrackType::Endpoint &ep = links[j]->get_type().get_endpoints()[links[j]->get_endpoint_by_link(**i)];
int p = get_turnout(tid2);
if(p>=0 && !(ep.paths&(1<<p)))
{
{
// Linked to an existing track - good
result |= 1;
- const vector<Endpoint> &endpoints = (*i)->get_type().get_endpoints();
+ const vector<TrackType::Endpoint> &endpoints = (*i)->get_type().get_endpoints();
if(unsigned tid=(*i)->get_turnout_id())
{
int r = get_turnout(tid);
continue;
unsigned path_mask = 1<<j->second;
- const vector<Endpoint> &eps = (*i)->get_type().get_endpoints();
+ const vector<TrackType::Endpoint> &eps = (*i)->get_type().get_endpoints();
for(unsigned k=0; k<eps.size(); ++k)
if(eps[k].paths&path_mask)
{