Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Gorbushin <m.gorbushin@corp.mail.ru>2019-09-04 20:52:11 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2019-09-05 17:03:48 +0300
commit42770049dda99666f82d7b7977d50ff1eacc0f13 (patch)
treef5901b22584322cb37b397d40705382fd356c907 /routing/index_router.cpp
parent6fc028f0a609204d20604d94322804d9c4aa4ac9 (diff)
[routing] Fix crash about times at route points
Diffstat (limited to 'routing/index_router.cpp')
-rw-r--r--routing/index_router.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/routing/index_router.cpp b/routing/index_router.cpp
index 5052d9a566..3c9ba846ae 100644
--- a/routing/index_router.cpp
+++ b/routing/index_router.cpp
@@ -1310,17 +1310,20 @@ RouterResultCode IndexRouter::RedressRoute(vector<Segment> const & segments,
Route::TTimes times;
times.reserve(segments.size());
- double time = 0.0;
+
+ // Time at zero route point.
times.emplace_back(static_cast<uint32_t>(0), 0.0);
- for (size_t i = 0; i < segments.size() - 1; ++i)
+ // Time at first route point - weight of first segment.
+ double time = starter.CalculateETAWithoutPenalty(segments.front());
+ times.emplace_back(static_cast<uint32_t>(1), time);
+
+ for (size_t i = 1; i < segments.size(); ++i)
{
- time += starter.CalculateETA(segments[i], segments[i + 1]);
+ time += starter.CalculateETA(segments[i - 1], segments[i]);
times.emplace_back(static_cast<uint32_t>(i + 1), time);
}
- times.emplace_back(static_cast<uint32_t>(segments.size()), time);
-
CHECK(m_directionsEngine, ());
ReconstructRoute(*m_directionsEngine, roadGraph, m_trafficStash, delegate, junctions, move(times),
route);