do not consider empty-names + empty-refs a valid name for u-turns

This commit is contained in:
Moritz Kobitzsch 2017-10-27 11:19:11 +02:00 committed by Patrick Niklaus
parent 4bf3c97476
commit e197dae54d
2 changed files with 8 additions and 3 deletions

View File

@ -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 |

View File

@ -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)