Skip to content

Commit

Permalink
fix #14780
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 26, 2024
1 parent f1bdb08 commit 1ab8e77
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/microsim/transportables/MSPModel_Striping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,24 @@ MSPModel_Striping::getNextLane(const PState& ped, const MSLane* currentLane, con
}
} else {
// walk forward by default
nextDir = junction == nextRouteEdge->getToJunction() ? BACKWARD : FORWARD;
if (junction == nextRouteEdge->getToJunction()) {
nextDir = BACKWARD;
} else if (junction == nextRouteEdge->getFromJunction()) {
nextDir = FORWARD;
} else {
// topological disconnect, find a direction that makes sense
// for the future part of the route
ConstMSEdgeVector futureRoute = ped.myStage->getRoute();
futureRoute.erase(futureRoute.begin(), futureRoute.begin() + ped.myStage->getRoutePosition() + 1);
int passedFwd = 0;
int passedBwd = 0;
canTraverse(FORWARD, futureRoute, passedFwd);
canTraverse(BACKWARD, futureRoute, passedBwd);
nextDir = (passedFwd >= passedBwd) ? FORWARD : BACKWARD;
if DEBUGCOND(ped) {
std::cout << " nextEdge=" << nextRouteEdge->getID() << " passedFwd=" << passedFwd << " passedBwd=" << passedBwd << " futureRoute=" << toString(futureRoute) << " nextDir=" << nextDir << "\n";
}
}
// try to use a direct link as fallback
// direct links only exist if built explicitly. They are used to model tl-controlled links if there are no crossings
if (ped.myDir == FORWARD) {
Expand Down

0 comments on commit 1ab8e77

Please sign in to comment.