]> git.tdb.fi Git - r2c2.git/commitdiff
Ignore dubious speed measurements when finding speed step
authorMikko Rasa <tdb@tdb.fi>
Sun, 13 Feb 2011 20:50:46 +0000 (20:50 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 13 Feb 2011 20:50:46 +0000 (20:50 +0000)
source/libr2c2/train.cpp

index 5b03e9b5e6946827a966080de5fb86084a8db0fa..218b6861da183b0d24c3279046c4dc122aaae9ba 100644 (file)
@@ -1180,10 +1180,10 @@ unsigned Train::find_speed_step(float real) const
                if(real_speed[i].weight)
                {
                        last = i;
-                       if(real_speed[i].speed<real)
-                               low = i;
-                       else
+                       if(real_speed[i].speed>=real)
                                high = i;
+                       else if(real_speed[i].speed>real_speed[low].speed)
+                               low = i;
                }
        if(!high)
        {