From ceddfada3dfae23b04829ff78fb4fbe0d3629cca Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Tue, 25 Oct 2016 14:22:06 -0600 Subject: [PATCH] Don't mark all lanes as designated when there are blank lane specifiers in the tag. --- features/car/access.feature | 2 ++ profiles/car.lua | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/features/car/access.feature b/features/car/access.feature index bcbdae874..96f5c04ff 100644 --- a/features/car/access.feature +++ b/features/car/access.feature @@ -170,6 +170,8 @@ Feature: Car - Restricted access | primary | | designated | | -1 | | x | | primary | | | designated | yes | | | | primary | | | designated | -1 | | | + | primary | | | designated\| | yes | x | | + | primary | | | designated\| | -1 | | x | | primary | | | designated\|designated | yes | | | | primary | | | designated\|designated | -1 | | | | primary | | | designated\|yes | yes | x | | diff --git a/profiles/car.lua b/profiles/car.lua index 6213ad31e..c2746bba1 100644 --- a/profiles/car.lua +++ b/profiles/car.lua @@ -261,7 +261,9 @@ function way_function (way, result) -- also respect user-preference for HOV-only ways when all lanes are HOV-designated local function has_all_designated_hov_lanes(lanes) local all = true - for lane in lanes:gmatch("(%w+)") do + -- This gmatch call effectively splits the string on | chars. + -- we append an extra | to the end so that we can match the final part + for lane in (lanes .. '|'):gmatch("([^|]*)|") do if lane and lane ~= "designated" then all = false break