From e197dae54d7e6a317661bd92b5abffe095f93f9b Mon Sep 17 00:00:00 2001 From: Moritz Kobitzsch Date: Fri, 27 Oct 2017 11:19:11 +0200 Subject: [PATCH] do not consider empty-names + empty-refs a valid name for u-turns --- features/guidance/collapse.feature | 4 ++-- include/engine/guidance/collapsing_utility.hpp | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/features/guidance/collapse.feature b/features/guidance/collapse.feature index 45dada307..0534d94e3 100644 --- a/features/guidance/collapse.feature +++ b/features/guidance/collapse.feature @@ -1096,5 +1096,5 @@ Feature: Collapse | be | residential | cross | no | | When I route I should get - | waypoints | route | turns | - | a,f | road,, | depart,continue uturn,arrive | + | waypoints | route | turns | + | a,f | road,cross,, | depart,turn left,on ramp left,arrive | diff --git a/include/engine/guidance/collapsing_utility.hpp b/include/engine/guidance/collapsing_utility.hpp index 6cd5af6da..d2c5a0d6d 100644 --- a/include/engine/guidance/collapsing_utility.hpp +++ b/include/engine/guidance/collapsing_utility.hpp @@ -121,9 +121,14 @@ inline bool haveSameMode(const RouteStep &first, const RouteStep &second, const // alias for readability inline bool haveSameName(const RouteStep &lhs, const RouteStep &rhs) { + const auto has_name_or_ref = [](auto const& step) { + return !step.name.empty() || !step.ref.empty(); + }; + // make sure empty is not involved - if (lhs.name_id == EMPTY_NAMEID || rhs.name_id == EMPTY_NAMEID) + if (!has_name_or_ref(lhs) || !has_name_or_ref(rhs)) { return false; + } // easy check to not go over the strings if not necessary else if (lhs.name_id == rhs.name_id)