]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/track.cpp
Consider failed track or block traversal a fatal error
[r2c2.git] / source / libmarklin / track.cpp
index 6c72c469a7540972f540e029d68bece473963c09..3c2a410fa9d55bf2ab131985a76f7ea4266d4f1c 100644 (file)
@@ -223,7 +223,7 @@ Track *Track::get_link(unsigned i) const
        return links[i];
 }
 
-int Track::traverse(unsigned i, unsigned path) const
+unsigned Track::traverse(unsigned i, unsigned path) const
 {
        const vector<Endpoint> &eps = type.get_endpoints();
        if(i>=eps.size())
@@ -246,7 +246,7 @@ int Track::traverse(unsigned i, unsigned path) const
                                return j;
        }
 
-       return -1;
+       throw Exception("Track endpoint did not have a counterpart");
 }
 
 Point Track::get_point(unsigned epi, unsigned path, float d) const