Skip to content

Commit

Permalink
do not consider empty-names + empty-refs a valid name for u-turns
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Kobitzsch authored and daniel-j-h committed Oct 27, 2017
1 parent dd3c894 commit 650ff37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions features/guidance/collapse.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
7 changes: 6 additions & 1 deletion include/engine/guidance/collapsing_utility.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 650ff37

Please sign in to comment.