Skip to content

Commit 99a9aa7

Browse files
authored
Merge pull request #526 from Csantucci/disappearing-AI
Bug fix for https://bugs.launchpad.net/or/+bug/1949292 AI train disappears after coupling and reversing
2 parents 30f6ab8 + 2bfe684 commit 99a9aa7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Source/Orts.Simulation/Simulation/AIs/AITrain.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4114,6 +4114,8 @@ public virtual bool[] ProcessEndOfPath(int presentTime, bool checkLoop = true)
41144114

41154115
int directionNow = ValidRoute[0][PresentPosition[0].RouteListIndex].Direction;
41164116
int positionNow = ValidRoute[0][PresentPosition[0].RouteListIndex].TCSectionIndex;
4117+
int directionNowBack = PresentPosition[1].TCDirection;
4118+
int positionNowBack = PresentPosition[1].TCSectionIndex;
41174119

41184120
bool[] nextPart = UpdateRouteActions(0, checkLoop);
41194121

@@ -4132,7 +4134,7 @@ public virtual bool[] ProcessEndOfPath(int presentTime, bool checkLoop = true)
41324134
Number.ToString() + " continued, part : " + TCRoute.activeSubpath.ToString() + "\n");
41334135
}
41344136

4135-
if (positionNow == PresentPosition[0].TCSectionIndex && directionNow != PresentPosition[0].TCDirection)
4137+
if (positionNowBack == PresentPosition[0].TCSectionIndex && directionNowBack != PresentPosition[0].TCDirection)
41364138
{
41374139
ReverseFormation(false);
41384140
// active subpath must be incremented in parallel in incorporated train if present

0 commit comments

Comments
 (0)