]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.cpp
Introduce a tilt (vertical angle) property to Object
[r2c2.git] / source / designer / designer.cpp
index 04e15d34c5e5a023d0b3cc514c70f8faff95f800..61f0d9c00fb495ca08b98ec6654858a2c550d0b4 100644 (file)
@@ -643,9 +643,8 @@ string Designer::tooltip(int x, int y)
                string info = format("%d %s", otype.get_article_number(), otype.get_description());
                if(Track *track = dynamic_cast<Track *>(obj))
                {
-                       const TrackType &ttype = track->get_type();
-                       if(mode!=CATALOGUE && abs(track->get_slope())>1e-4)
-                               info += format(" (slope %.1f%%)", abs(track->get_slope()/ttype.get_total_length()*100));
+                       if(mode!=CATALOGUE && abs(track->get_tilt()).radians()>1e-4)
+                               info += format(" (slope %.1f%%)", abs(tan(track->get_tilt())*100));
                        if(track->get_turnout_id())
                                info += format(" (turnout %d)", track->get_turnout_id());
                        else if(track->get_sensor_id())