Fix off-by-one in via_indices

This commit is contained in:
Patrick Niklaus 2015-11-24 21:05:18 +01:00
parent 71bf1edc5e
commit 420369fe13

View File

@ -230,8 +230,6 @@ void DescriptionFactory::Run(const unsigned zoom_level)
return; return;
} }
++necessary_segments;
if (first.is_via_location) if (first.is_via_location)
{ // mark the end of a leg (of several segments) { // mark the end of a leg (of several segments)
via_indices.push_back(necessary_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); const double pre_turn_bearing = coordinate_calculation::bearing(second.location, first.location);
first.post_turn_bearing = static_cast<short>(post_turn_bearing * 10); first.post_turn_bearing = static_cast<short>(post_turn_bearing * 10);
first.pre_turn_bearing = static_cast<short>(pre_turn_bearing * 10); first.pre_turn_bearing = static_cast<short>(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); BOOST_ASSERT(via_indices.size() >= 2);
return; return;
} }