Skip to content

Commit 411313f

Browse files
committed
Backport NumLanesToTheRight/NumLanesToTheLeft to support 6ea9f9f
1 parent ada0a1e commit 411313f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/engine/guidance/lane_processing.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,19 @@ std::vector<RouteStep> anticipateLaneChange(std::vector<RouteStep> steps,
4242
// since at the moment we first group-by and only then do Lane Anticipation selectively.
4343
//
4444
// We do not have a source-target lane mapping, assume worst case for lanes to cross.
45-
const auto to_cross = std::max(step.NumLanesToTheRight(), step.NumLanesToTheLeft());
45+
46+
// The following two lambda functions are backported from
47+
// https://github.com/Project-OSRM/osrm-backend/pull/3474
48+
const auto NumLanesToTheRight = [](const RouteStep &step) -> LaneID {
49+
return step.intersections.front().lanes.first_lane_from_the_right;
50+
};
51+
const auto NumLanesToTheLeft = [](const RouteStep &step) -> LaneID {
52+
LaneID const total = step.intersections.front().lane_description.size();
53+
return total - (step.intersections.front().lanes.lanes_in_turn +
54+
step.intersections.front().lanes.first_lane_from_the_right);
55+
};
56+
57+
const auto to_cross = std::max(NumLanesToTheRight(step), NumLanesToTheLeft(step));
4658
const auto scale = 1 + to_cross;
4759
const auto threshold = scale * min_duration_needed_for_lane_change;
4860

0 commit comments

Comments
 (0)