Open Looky1173 opened 4 years ago
Property | Value |
---|---|
Posted by | Bela Tegi (abelino) |
Date posted | Thu, 20 Aug 2020 08:42:44 GMT |
Property | Value |
---|---|
Posted by | Bela Tegi (abelino) |
Date posted | Sun, 23 Aug 2020 08:37:24 GMT |
Hi!
(I was a little free time, so I found one solution.)
Add few lines of code to Orts.Simulation/Simulation/Timetables/TTTrain.cs in "void FormTrainFromAI(int presentTime)" method:
if (validFormed) { +++ formedTrain.PresentPosition[0].RouteListIndex = PresentPosition[0].RouteListIndex; +++ formedTrain.PresentPosition[0].TCOffset = PresentPosition[0].TCOffset; +++ formedTrain.PresentPosition[0].TCSectionIndex = PresentPosition[0].TCSectionIndex; +++ formedTrain.PresentPosition[1].RouteListIndex = PresentPosition[1].RouteListIndex; +++ formedTrain.PresentPosition[1].TCOffset = PresentPosition[1].TCOffset; +++ formedTrain.PresentPosition[1].TCSectionIndex = PresentPosition[1].TCSectionIndex; // start new train if (!autogenStart) { AI.Simulator.StartReference.Remove(formedTrain.Number); }
Important! This patch resolves this issue, but I don't know, what else breaks!
Br: abelino
Imported from https://bugs.launchpad.net/bugs/1892330
Hi!
Timetable, formed train from arrived train (#dispose - $forms=...), when starting this activity occured the exception.
I debugged code and found in Orts.Simulation/Simulation/Physics/Train.cs, SetFormedOccupied() method: for (int iRouteIndex = rearIndex; iRouteIndex <= frontIndex; iRouteIndex++) where rearIndex and frontIndex was -1, and later use iRouteIndex as array element indexer, which lead to exception.
(FYI: When I NOT used forms in dispose row (not formed train), this exception not happen.)
Br.: abelino