]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.cpp
Correctly handle slope when snapping tracks
[r2c2.git] / source / designer / designer.cpp
index ba804f27980c30e6e368cabc7e95979b0e5229be..c5c274edbda8ccd3163b7f81ff30d777aed6cb15 100644 (file)
@@ -287,8 +287,8 @@ void Designer::tick()
                        ostringstream ss;
                        ss.precision(2);
                        ss<<ttype.get_article_number()<<' '<<ttype.get_description();
-                       if(mode!=CATALOGUE)
-                               ss<<" (slope "<<track.get_slope()/ttype.get_total_length()*100<<"%)";
+                       if(mode!=CATALOGUE && abs(track.get_slope())>1e-4)
+                               ss<<" (slope "<<abs(track.get_slope()/ttype.get_total_length()*100)<<"%)";
                        if(track.get_turnout_id())
                                ss<<" (turnout "<<track.get_turnout_id()<<')';
                        else if(track.get_sensor_id())