]> git.tdb.fi Git - r2c2.git/commitdiff
Add both addresses of a double-address turnout
authorMikko Rasa <tdb@tdb.fi>
Tue, 23 Mar 2010 21:14:38 +0000 (21:14 +0000)
committerMikko Rasa <tdb@tdb.fi>
Tue, 23 Mar 2010 21:14:38 +0000 (21:14 +0000)
Fix get_point to accept a distance exactly equal to the path length

source/libmarklin/track.cpp
source/libmarklin/tracktype.cpp

index 7c08b6c46766c0d3e116c775d2f9f802e5c81653..fc365862301c9acfa0734ccd3b510b7a5c6cbe77 100644 (file)
@@ -104,7 +104,11 @@ void Track::set_turnout_id(unsigned i)
        turnout_id = i;
        layout.create_blocks(*this);
        if(layout.has_driver() && turnout_id)
+       {
                layout.get_driver().add_turnout(turnout_id);
+               if(type.is_double_address())
+                       layout.get_driver().add_turnout(turnout_id+1);
+       }
 }
 
 void Track::set_sensor_id(unsigned i)
index 314c797c97ec813928382b02a9374c6b528c47fa..19b0c6b4a3e83ecbeeef8a10fe710d832d8ce993 100644 (file)
@@ -89,7 +89,7 @@ TrackPoint TrackType::get_point(unsigned epi, unsigned path, float d) const
        while(1)
        {
                float plen = part->get_length();
-               if(d<plen)
+               if(d<=plen)
                {
                        if(part_ep==1)
                                d = plen-d;