diff --git a/routing/road_graph_router.cpp b/routing/road_graph_router.cpp index 0c782a2fe0..a8e5448274 100644 --- a/routing/road_graph_router.cpp +++ b/routing/road_graph_router.cpp @@ -207,8 +207,8 @@ IRouter::ResultCode RoadGraphRouter::CalculateRoute(m2::PointD const & startPoin CalculateMaxSpeedTimes(*m_roadGraph, result.path, times); CHECK(m_directionsEngine, ()); - ReconstructRoute(*m_directionsEngine, *m_roadGraph, nullptr, delegate, true, result.path, - std::move(times), route); + ReconstructRoute(*m_directionsEngine, *m_roadGraph, nullptr /* trafficStash */, delegate, + true /* hasAltitude */, result.path, std::move(times), route); } m_roadGraph->ResetFakes(); diff --git a/routing/routing_helpers.cpp b/routing/routing_helpers.cpp index 64cd1fcf48..a629900cc9 100644 --- a/routing/routing_helpers.cpp +++ b/routing/routing_helpers.cpp @@ -30,7 +30,7 @@ void ReconstructRoute(IDirectionsEngine & engine, RoadGraphBase const & graph, } CHECK_EQUAL(path.size(), times.size(), ()); - + Route::TTurns turnsDir; vector junctions; Route::TStreets streetNames; @@ -98,7 +98,7 @@ void CalculateMaxSpeedTimes(RoadGraphBase const & graph, vector const Route::TTimes & times) { times.clear(); - if (path.size() < 1) + if (path.empty()) return; // graph.GetMaxSpeedKMPH() below is used on purpose. @@ -109,23 +109,21 @@ void CalculateMaxSpeedTimes(RoadGraphBase const & graph, vector const // the most likely a pedestrian (a cyclist) will go along big roads with average // speed (graph.GetMaxSpeedKMPH()). double const speedMPS = graph.GetMaxSpeedKMPH() * KMPH2MPS; + CHECK_GREATER(speedMPS, 0.0, ()); times.reserve(path.size()); double trackTimeSec = 0.0; times.emplace_back(0, trackTimeSec); - m2::PointD prev = path[0].GetPoint(); for (size_t i = 1; i < path.size(); ++i) { - m2::PointD const & curr = path[i].GetPoint(); - - double const lengthM = MercatorBounds::DistanceOnEarth(prev, curr); + double const lengthM = + MercatorBounds::DistanceOnEarth(path[i - 1].GetPoint(), path[i].GetPoint()); trackTimeSec += lengthM / speedMPS; times.emplace_back(i, trackTimeSec); - - prev = curr; } + CHECK_EQUAL(times.size(), path.size(), ()); } } // namespace routing diff --git a/routing/turns_generator.cpp b/routing/turns_generator.cpp index e267143ddf..932a578063 100644 --- a/routing/turns_generator.cpp +++ b/routing/turns_generator.cpp @@ -259,7 +259,7 @@ IRouter::ResultCode MakeTurnAnnotation(turns::IRoutingResult const & result, Route::TStreets & streets, vector & segments) { LOG(LDEBUG, ("Shortest th length:", result.GetPathLength())); - + if (delegate.IsCancelled()) return IRouter::Cancelled; // Annotate turns.