@@ -9226,23 +9226,47 @@ public void UpdateExplorerMode(int signalObjectIndex)
92269226 // get next signal
92279227
92289228 // forward
9229+ float distanceToSignalForward = 0;
9230+ float lengthOffset = PresentPosition[0].TCOffset;
92299231 NextSignalObject[0] = null;
92309232 for (int iindex = 0; iindex < ValidRoute[0].Count && NextSignalObject[0] == null; iindex++)
92319233 {
92329234 TCRouteElement thisElement = ValidRoute[0][iindex];
92339235 TrackCircuitSection thisSection = signalRef.TrackCircuitList[thisElement.TCSectionIndex];
92349236 NextSignalObject[0] = thisSection.EndSignals[thisElement.Direction];
9237+ if (iindex >= PresentPosition[0].RouteListIndex)
9238+ {
9239+ distanceToSignalForward += thisSection.Length - lengthOffset;
9240+ lengthOffset = 0;
9241+ }
92359242 }
92369243
92379244 // backward
9245+ float distanceToSignalBackward = 0;
9246+ lengthOffset = 0;
9247+ int presentIndex = -1;
92389248 NextSignalObject[1] = null;
92399249 for (int iindex = 0; iindex < ValidRoute[1].Count && NextSignalObject[1] == null; iindex++)
92409250 {
92419251 TCRouteElement thisElement = ValidRoute[1][iindex];
92429252 TrackCircuitSection thisSection = signalRef.TrackCircuitList[thisElement.TCSectionIndex];
92439253 NextSignalObject[1] = thisSection.EndSignals[thisElement.Direction];
9254+ if (presentIndex == -1 && PresentPosition[1].TCSectionIndex == thisElement.TCSectionIndex)
9255+ {
9256+ lengthOffset = -PresentPosition[1].TCOffset + signalRef.TrackCircuitList[PresentPosition[1].TCSectionIndex].Length;
9257+ presentIndex = iindex;
9258+ }
9259+ if (presentIndex != -1 && presentIndex <= iindex)
9260+ {
9261+ distanceToSignalBackward += thisSection.Length - lengthOffset;
9262+ lengthOffset = 0;
9263+ }
92449264 }
92459265
9266+ DistanceToSignal = null;
9267+ if (MUDirection != Direction.Reverse && NextSignalObject[0] != null) DistanceToSignal = distanceToSignalForward;
9268+ if (MUDirection == Direction.Reverse && NextSignalObject[1] != null) DistanceToSignal = distanceToSignalBackward;
9269+
92469270 // clear all build up distance actions
92479271 requiredActions.RemovePendingAIActionItems(true);
92489272 }
0 commit comments