]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/block.cpp
Add a path_changed signal to Track
[r2c2.git] / source / libmarklin / block.cpp
index b9b65ad710dca9dd833177ee993b31562c3c4b5b..1519401220edf59481427c68621985c0cf528f69 100644 (file)
@@ -103,12 +103,7 @@ float Block::get_path_length(unsigned entry, const Route *route) const
        float result = 0;
        while(t_iter && has_track(*t_iter))
        {
-               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());
                result += t_iter->get_type().get_path_length(path);
 
                t_iter = t_iter.next(path);