Skip to content

Commit

Permalink
fix #11835
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Oct 14, 2022
1 parent e8abdaf commit 902e032
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/utils/router/RailwayRouter.h
Expand Up @@ -116,6 +116,18 @@ class RailwayRouter : public SUMOAbstractRouter<E, V> {
break;
}
backDist -= prev->getLength();
if (prev->getSuccessors().size() > 1) {
bool foundSwitch = false;
for (const E* succ : prev->getSuccessors()) {
if (succ != start && succ != prev->getBidiEdge()) {
foundSwitch = true;
break;
}
}
if (foundSwitch) {
break;
}
}
backLengths.push_back(prev->getLength() + (backLengths.empty() ? from->getLength() : backLengths.back()));
start = prev;
}
Expand All @@ -141,7 +153,7 @@ class RailwayRouter : public SUMOAbstractRouter<E, V> {
// skip the virtual back-edges
into.erase(into.begin() + intoSize, into.begin() + intoSize + backLengths.size());
#ifdef RailwayRouter_DEBUG_ROUTES
std::cout << "RailRouter: backLengths=" << toString(backLengths) << " final result=" << toString(into) << "\n";
std::cout << "RailRouter: backLengths=" << toString(backLengths) << " intoSize=" << intoSize << " final result=" << toString(into) << "\n";
#endif
if (*(into.begin() + intoSize) != from) {
WRITE_WARNING("Railway routing failure due to turn-around on short edge '" + from->getID()
Expand Down

0 comments on commit 902e032

Please sign in to comment.