From 420369fe139f08d121c3d905f22fe1785d488979 Mon Sep 17 00:00:00 2001 From: Patrick Niklaus Date: Tue, 24 Nov 2015 21:05:18 +0100 Subject: [PATCH] Fix off-by-one in via_indices --- descriptors/description_factory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/descriptors/description_factory.cpp b/descriptors/description_factory.cpp index 6da7ad5cb..5086e0d17 100644 --- a/descriptors/description_factory.cpp +++ b/descriptors/description_factory.cpp @@ -230,8 +230,6 @@ void DescriptionFactory::Run(const unsigned zoom_level) return; } - ++necessary_segments; - if (first.is_via_location) { // mark the end of a leg (of several segments) via_indices.push_back(necessary_segments); @@ -241,9 +239,11 @@ void DescriptionFactory::Run(const unsigned zoom_level) const double pre_turn_bearing = coordinate_calculation::bearing(second.location, first.location); first.post_turn_bearing = static_cast(post_turn_bearing * 10); first.pre_turn_bearing = static_cast(pre_turn_bearing * 10); + + ++necessary_segments; }); - via_indices.push_back(necessary_segments + 1); + via_indices.push_back(necessary_segments); BOOST_ASSERT(via_indices.size() >= 2); return; }