Only penaltize bidirectional ways if they have 1 lane
This commit is contained in:
+4
-2
@@ -412,11 +412,13 @@ function way_function (way, result)
|
||||
end
|
||||
end
|
||||
|
||||
local is_bidirectional = result.forward_mode ~= 0 and result.backward_mode ~= 0
|
||||
|
||||
-- scale speeds to get better avg driving times
|
||||
if result.forward_speed > 0 then
|
||||
local scaled_speed = result.forward_speed*speed_reduction + 11;
|
||||
local penalized_speed = math.huge
|
||||
if width <= 3 or lanes <= 1 then
|
||||
if width <= 3 or (lanes <= 1 and is_bidirectional) then
|
||||
penalized_speed = result.forward_speed / 2;
|
||||
end
|
||||
result.forward_speed = math.min(penalized_speed, scaled_speed)
|
||||
@@ -425,7 +427,7 @@ function way_function (way, result)
|
||||
if result.backward_speed > 0 then
|
||||
local scaled_speed = result.backward_speed*speed_reduction + 11;
|
||||
local penalized_speed = math.huge
|
||||
if width <= 3 or lanes <= 1 then
|
||||
if width <= 3 or (lanes <= 1 and is_bidirectional) then
|
||||
penalized_speed = result.backward_speed / 2;
|
||||
end
|
||||
result.backward_speed = math.min(penalized_speed, scaled_speed)
|
||||
|
||||
Reference in New Issue
Block a user