]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/blockiter.cpp
Add a path_changed signal to Track
[r2c2.git] / source / libmarklin / blockiter.cpp
index 7618e4b15943dd39ba044bdc90f948a13d2fceaa..96159577cb6c488aa062ba33298f0499075cddfd 100644 (file)
@@ -48,19 +48,14 @@ int BlockIter::get_exit(const Route *route) const
                if(!_block->has_track(*t_iter))
                        throw LogicError("Block traversal strayed out of the block");
 
-               int path = -1;
-               if(t_iter->get_turnout_id() && route)
-                       path = route->get_turnout(t_iter->get_turnout_id());
-               if(path==-1)
-                       path = t_iter->get_active_path();
-
+               unsigned path = (route ? route->get_path(*t_iter) : t_iter->get_active_path());
                TrackIter t_exit = t_iter.reverse(path);
 
                for(unsigned i=0; i<eps.size(); ++i)
                        if(eps[i].track==t_exit.track() && eps[i].track_ep==t_exit.entry())
                                return i;
 
-               t_iter = t_iter.next(path);
+               t_iter = t_exit.flip();
        }
 
        return -1;