PR fixes.

This commit is contained in:
Lev Dragunov 2015-10-07 16:51:44 +03:00
parent 86b1328a35
commit 27c2967271
3 changed files with 7 additions and 6 deletions

View file

@ -435,8 +435,8 @@ double RoutingSession::GetDistanceToCurrentCamM(SpeedCameraRestriction & camera,
camera = m_lastCheckedCamera;
return m_poly.GetDistanceM(currentIter, m_poly.GetIterToIndex(camera.m_index));
}
size_t const currentIndex = max(static_cast<size_t>(currentIter.m_ind),
static_cast<size_t>(m_lastCheckedCamera.m_index) + 1);
size_t const currentIndex = max(currentIter.m_ind,
m_lastCheckedCamera.m_index + 1);
for (size_t i = currentIndex; i < m_poly.GetPolyline().GetSize(); ++i)
{
uint8_t speed = CheckCameraInPoint(m_poly.GetPolyline().GetPoint(i), index);

View file

@ -26,10 +26,10 @@ namespace routing
{
struct SpeedCameraRestriction
{
uint32_t m_index; // Index of a polyline point where camera is located.
size_t m_index; // Index of a polyline point where camera is located.
uint8_t m_maxSpeedKmH; // Maximum speed allowed by the camera.
SpeedCameraRestriction(uint32_t index, uint8_t maxSpeed) : m_index(index), m_maxSpeedKmH(maxSpeed) {}
SpeedCameraRestriction(size_t index, uint8_t maxSpeed) : m_index(index), m_maxSpeedKmH(maxSpeed) {}
SpeedCameraRestriction() : m_index(0), m_maxSpeedKmH(numeric_limits<uint8_t>::max()) {}
};

View file

@ -33,8 +33,9 @@ uint8_t ReadCameraRestriction(FeatureType & ft)
if (speed.empty())
return 0;
int result;
strings::to_int(speed, result);
return result;
if (strings::to_int(speed, result))
return result;
return 0;
}
uint8_t CheckCameraInPoint(m2::PointD const & point, Index const & index)