X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Froute.cpp;h=77c4f9280532537e41614c37837f66a82cca67a6;hb=b88d3630a0e3fdd763db018bbe5dbfe3180a95f2;hp=be2eefc258ea8cfc7e135932e9ab325c1611ee96;hpb=64340dad429ba4040538fc06b6882aabdb489925;p=r2c2.git diff --git a/source/libr2c2/route.cpp b/source/libr2c2/route.cpp index be2eefc..77c4f92 100644 --- a/source/libr2c2/route.cpp +++ b/source/libr2c2/route.cpp @@ -83,9 +83,9 @@ list dijkstra(const TrackIter &from, const Pred &goal) break; } - unsigned paths = lowest.track.endpoint().paths; - for(unsigned i=0; paths>>i; ++i) - if(paths&(1<>i; ++i) + if(ep.has_path(i)) { TrackIter next = lowest.track.next(i); if(!next) @@ -198,7 +198,7 @@ void Route::update_turnouts() { const TrackType::Endpoint &ep = links[j]->get_type().get_endpoint(links[j]->get_endpoint_by_link(**i)); int p = get_turnout(tid2); - if(p>=0 && !(ep.paths&(1<=0 && !ep.has_path(p)) { // The linked track is a turnout and has a path which is incompatible with this endpoint mask &= ~endpoints[j].paths; @@ -350,7 +350,7 @@ RouteValidityMask Route::check_validity(Track &trk) const if(path>=0) { // Linking to a turnout with path set is only good if we're continuing that path - if(ep.paths&(1<get_type().get_endpoint(tlinks[j]->get_endpoint_by_link(**i)); path = get_turnout(tid2); // Ignore a linked turnout with some other path set - if(path>=0 && !(ep2.paths&(1<=0 && !ep2.has_path(path)) continue; } ++count; const TrackType::Endpoint &ep2 = (*i)->get_type().get_endpoint(j); - if(!(ep.paths&ep2.paths)) + if(!ep.has_common_paths(ep2)) // Impossible path through the turnout - not good result &= ~ROUTE_SMOOTH; } @@ -438,10 +438,9 @@ void Route::Loader::finish() if(j==turnouts.end()) continue; - unsigned path_mask = 1<second; const vector &eps = (*i)->get_type().get_endpoints(); for(unsigned k=0; ksecond)) { Track *link = (*i)->get_link(k); if(!obj.tracks.count(link))