From c12e074c6b9b5136e72931fb47a562e40e0a24f9 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 23 Mar 2010 21:14:38 +0000 Subject: [PATCH] Add both addresses of a double-address turnout Fix get_point to accept a distance exactly equal to the path length --- source/libmarklin/track.cpp | 4 ++++ source/libmarklin/tracktype.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/libmarklin/track.cpp b/source/libmarklin/track.cpp index 7c08b6c..fc36586 100644 --- a/source/libmarklin/track.cpp +++ b/source/libmarklin/track.cpp @@ -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) diff --git a/source/libmarklin/tracktype.cpp b/source/libmarklin/tracktype.cpp index 314c797..19b0c6b 100644 --- a/source/libmarklin/tracktype.cpp +++ b/source/libmarklin/tracktype.cpp @@ -89,7 +89,7 @@ TrackPoint TrackType::get_point(unsigned epi, unsigned path, float d) const while(1) { float plen = part->get_length(); - if(d