System.ArgumentOutOfRangeException at Orts.Simulation.Physics.Train.SetFormedOccupied (1.3.1.4328)
Bug #1892330 reported by
Bela Tegi
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Open Rails |
New
|
Undecided
|
Unassigned |
Bug Description
Hi!
Timetable, formed train from arrived train (#dispose - $forms=...), when starting this activity occured the exception.
I debugged code and found in Orts.Simulation
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
summary: |
- Index was out of range exception when start activity. + System.ArgumentOutOfRangeException at + Orts.Simulation.Physics.Train.SetFormedOccupied (1.3.1.4328) |
tags: | added: crash physics |
To post a comment you must log in.
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) PresentPosition [0].RouteListIn dex = PresentPosition [0].RouteListIn dex; PresentPosition [0].TCOffset = PresentPosition [0].TCOffset; PresentPosition [0].TCSectionIn dex = PresentPosition [0].TCSectionIn dex; PresentPosition [1].RouteListIn dex = PresentPosition [1].RouteListIn dex; PresentPosition [1].TCOffset = PresentPosition [1].TCOffset; PresentPosition [1].TCSectionIn dex = PresentPosition [1].TCSectionIn dex; Simulator. StartReference. Remove( formedTrain. Number) ;
{
+++ formedTrain.
+++ formedTrain.
+++ formedTrain.
+++ formedTrain.
+++ formedTrain.
+++ formedTrain.
// start new train
if (!autogenStart)
{
AI.
}
Important! This patch resolves this issue, but I don't know, what else breaks!
Br: abelino