]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/trackiter.cpp
Use path coercion in track iterators
[r2c2.git] / source / libr2c2 / trackiter.cpp
index e07c71c02bac8faa42f7ec067eb184c3f7847e97..330e2f66c810bd9ee2c38cd0c6f2f1ebd14ae6d7 100644 (file)
@@ -37,7 +37,9 @@ BlockIter TrackIter::block_iter() const
 
        if(!_track->get_type().is_turnout())
        {
-               TrackIter rev = reverse();
+               /* Since there was no endpoint match, the preceding track can't be in a
+               different block. */
+               TrackIter rev = flip();
                TrackIter last;
                while(rev && &rev.track()->get_block()==&block)
                {
@@ -68,6 +70,7 @@ const TrackType::Endpoint &TrackIter::endpoint() const
 
 int TrackIter::get_exit(unsigned path) const
 {
+       path = _track->get_type().coerce_path(_entry, path);
        const vector<TrackType::Endpoint> &eps = _track->get_type().get_endpoints();
        
        // Find an endpoint that's connected to the entry and has the requested path