]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/track.cpp
Add a utility function to get path length from Track
[r2c2.git] / source / libr2c2 / track.cpp
index 8ecb9b9bac00833eaa70190982fcb1933b43e9ae..4708db5d40de6c79d26de28ef61af696afe6f48d 100644 (file)
@@ -183,6 +183,13 @@ void Track::set_active_path(unsigned p)
        layout.get_driver().set_turnout(turnout_id, p);
 }
 
+float Track::get_path_length(int p) const
+{
+       if(p<0)
+               p = active_path;
+       return type.get_path_length(p);
+}
+
 OrientedPoint Track::get_point(unsigned epi, unsigned path, float d) const
 {
        OrientedPoint p = type.get_point(epi, path, d);