From 367933fc1a9705e8ea852b8470f9db2d0f6f73fb Mon Sep 17 00:00:00 2001 From: rezashokry <45337530+rezashokry@users.noreply.github.com> Date: Mon, 25 Mar 2024 01:18:28 +0330 Subject: [PATCH] Fix manuever overrides finding bug (#6739) * sort manuever overrides vector after partition --------- Co-authored-by: rshokri Co-authored-by: Michael Bell --- CHANGELOG.md | 2 ++ src/partitioner/partitioner.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7078ae5c0ed..5414c892390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,8 +37,10 @@ - Routing: - FIXED: Fix adding traffic signal penalties during compression [#6419](https://github.com/Project-OSRM/osrm-backend/pull/6419) - FIXED: Correctly handle compressed traffic signals. [#6724](https://github.com/Project-OSRM/osrm-backend/pull/6724) + - FIXED: Fix bug when searching for maneuver overrides [#6739](https://github.com/Project-OSRM/osrm-backend/pull/6739) - Debug tiles: - FIXED: Ensure speed layer features have unique ids. [#6726](https://github.com/Project-OSRM/osrm-backend/pull/6726) + # 5.27.1 - Changes from 5.27.0 - Misc: diff --git a/src/partitioner/partitioner.cpp b/src/partitioner/partitioner.cpp index 636bd290e45..e8544bf64de 100644 --- a/src/partitioner/partitioner.cpp +++ b/src/partitioner/partitioner.cpp @@ -162,6 +162,14 @@ int Partitioner::Run(const PartitionerConfig &config) extractor::files::readManeuverOverrides(filename, maneuver_overrides, node_sequences); renumber(maneuver_overrides, permutation); renumber(node_sequences, permutation); + + // Although the vector is already sorted, the rename function changes the identifiers, so + // the order is not sorted now. So we sort by `from_node` again, so that later lookups can + // be done with a binary search. + std::sort(maneuver_overrides.begin(), + maneuver_overrides.end(), + [](const auto &a, const auto &b) { return a.start_node < b.start_node; }); + extractor::files::writeManeuverOverrides(filename, maneuver_overrides, node_sequences); } if (boost::filesystem::exists(config.GetPath(".osrm.hsgr")))