]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/track.cpp
Things with different gauges don't go together
[r2c2.git] / source / libr2c2 / track.cpp
index 680e6ea8746cbe63ba7a2c797c8a952da6a625a4..f1fdd992822180c26ddd5c39a6095bb8145516e4 100644 (file)
@@ -320,7 +320,11 @@ bool Track::link_to(Object &other)
        if(!otrack)
                return false;
 
-       float limit = type.get_appearance().get_gauge();
+       float gauge_ratio = otrack->get_type().get_gauge()/type.get_gauge();
+       if(gauge_ratio<0.99 || gauge_ratio>1.01)
+               return false;
+
+       float limit = type.get_gauge();
        if(!flex && !otrack->get_flex())
                limit /= 10;
        limit *= limit;