diff --git a/CHANGELOG.md b/CHANGELOG.md index a9c8b2535..69931f060 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - fixed compile errors in tile unit-test framework - fixed a bug that could result in inconsistent behaviour when collapsing instructions - fixed a bug that could result in crashes when leaving a ferry directly onto a motorway ramp + - fixed a bug in the tile plugin that resulted in discovering invalid edges for connections - Debug Tiles - Added support for turn penalties diff --git a/src/engine/plugins/tile.cpp b/src/engine/plugins/tile.cpp index bc3fb2f0b..e4054c6dd 100644 --- a/src/engine/plugins/tile.cpp +++ b/src/engine/plugins/tile.cpp @@ -459,10 +459,22 @@ Status TilePlugin::HandleRequest(const std::shared_ptrFindSmallestEdge( - approachedge.edge_based_node_id, - exit_edge.edge_based_node_id, - [](const contractor::QueryEdge::EdgeData &data) { return data.forward; }); + // Since we only want to find direct edges, we cannot check shortcut edges here. + // Otherwise we might find a forward edge even though a shorter backward edge + // exists (due to oneways). + // + // a > - > - > - b + // | | + // |------ c ----| + // + // would offer a backward edge at `b` to `a` (due to the oneway from a to b) + // but could also offer a shortcut (b-c-a) from `b` to `a` which is longer. + EdgeID smaller_edge_id = + facade->FindSmallestEdge(approachedge.edge_based_node_id, + exit_edge.edge_based_node_id, + [](const contractor::QueryEdge::EdgeData &data) { + return data.forward && !data.shortcut; + }); // Depending on how the graph is constructed, we might have to look for // a backwards edge instead. They're equivalent, just one is available for @@ -475,7 +487,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr