diff --git a/routing/osrm2feature_map.cpp b/routing/osrm2feature_map.cpp index 8924a57ec1..0d51b4168e 100644 --- a/routing/osrm2feature_map.cpp +++ b/routing/osrm2feature_map.cpp @@ -59,8 +59,7 @@ bool FtSeg::Merge(FtSeg const & other) if (other.m_fid != m_fid) return false; - bool const dir = other.m_pointEnd > other.m_pointStart; - if (dir != (m_pointEnd > m_pointStart)) + if (IsForward() != other.IsForward()) return false; auto const s1 = min(m_pointStart, m_pointEnd); @@ -72,7 +71,7 @@ bool FtSeg::Merge(FtSeg const & other) { m_pointStart = min(s1, s2); m_pointEnd = max(e1, e2); - if (!dir) + if (!other.IsForward()) swap(m_pointStart, m_pointEnd); return true; diff --git a/routing/osrm2feature_map.hpp b/routing/osrm2feature_map.hpp index c487a0c6df..ec7e918161 100644 --- a/routing/osrm2feature_map.hpp +++ b/routing/osrm2feature_map.hpp @@ -57,6 +57,8 @@ namespace OsrmMappingTypes bool IsIntersect(FtSeg const & other) const; + bool IsForward() const { return m_pointEnd > m_pointStart; } + bool IsValid() const { return m_fid != kInvalidFid;