From dfb7ed7f7bb0bf401248469f4dd1ee0493714f9d Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Tue, 15 Oct 2019 12:44:44 +0300 Subject: [PATCH] [routing] Since former weight factors and weight speed are used, they should be multiplied to each other if maxspeed is not set. --- routing_common/vehicle_model.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routing_common/vehicle_model.cpp b/routing_common/vehicle_model.cpp index fb03cbad5f..f881281c88 100644 --- a/routing_common/vehicle_model.cpp +++ b/routing_common/vehicle_model.cpp @@ -199,7 +199,11 @@ SpeedKMpH VehicleModel::GetSpeedOnFeatureWithoutMaxspeed(HighwayType const & typ SpeedKMpH const speed = speedIt->second.GetSpeed(isCityRoad); ASSERT(speed.IsValid(), (speed)); - return Pick(factorIt->second.GetFactor(isCityRoad) * speed, maxModelSpeed); + // Note. Weight speeds put to |m_highwayBasedInfo| are taken from the former code and should not + // be multiplied to the factor. On the contrary eta speed should be multiplied. + return SpeedKMpH( + min(speed.m_weight, maxModelSpeed.m_weight), + min(factorIt->second.GetFactor(isCityRoad).m_eta * speed.m_eta, maxModelSpeed.m_eta)); } SpeedKMpH VehicleModel::GetTypeSpeed(feature::TypesHolder const & types,