From e536d05ad748c5892c2ca967172d80fe10712f04 Mon Sep 17 00:00:00 2001 From: namdre Date: Thu, 22 Mar 2018 21:24:52 +0100 Subject: [PATCH] extending carriage drawing beyond myFurtherLanes. refs #3907 --- src/guisim/GUIVehicle.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/guisim/GUIVehicle.cpp b/src/guisim/GUIVehicle.cpp index aae72bb6b927..68b9283e62ed 100644 --- a/src/guisim/GUIVehicle.cpp +++ b/src/guisim/GUIVehicle.cpp @@ -548,6 +548,14 @@ GUIVehicle::getPreviousLane(MSLane* current, int& furtherIndex) const { if (furtherIndex < (int)myFurtherLanes.size()) { return myFurtherLanes[furtherIndex++]; } else { + int routeIndex = getCurrentRouteEdge() - myRoute->begin(); + int backIndex = furtherIndex + 1; + if (routeIndex > backIndex) { + furtherIndex++; + // could also look for the first lane that allows this vehicle class + // but this is probably not an issue for trains + return (*(getCurrentRouteEdge() - backIndex))->getLanes()[0]; + } return current; } }