Skip to content

Commit 36d87c3

Browse files
- functtion matchesConsistNoOrder now returns train when train contains the wagons of the activity drop off wagonlist
- Some actvity lists may only contain the first and last wagon. Check that first and last wagon match with those two wagons in the activity list. - check if drop off train is a STATIC one
1 parent ba9e40a commit 36d87c3

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

Source/Orts.Simulation/Simulation/Activity.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,12 @@ override public Boolean Triggered(Activity activity)
13271327
consistTrain = matchesConsistNoOrder(ChangeWagonIdList);
13281328
if (consistTrain != null)
13291329
{
1330-
if (atSiding(consistTrain.FrontTDBTraveller, consistTrain.RearTDBTraveller, this.SidingEnd1, this.SidingEnd2))
1330+
if (consistTrain.TrainType == Train.TRAINTYPE.STATIC)
13311331
{
1332-
triggered = true;
1332+
if (atSiding(consistTrain.FrontTDBTraveller, consistTrain.RearTDBTraveller, this.SidingEnd1, this.SidingEnd2))
1333+
{
1334+
triggered = true;
1335+
}
13331336
}
13341337
}
13351338
break;
@@ -1378,7 +1381,7 @@ private Train matchesConsist(List<string> wagonIdList)
13781381
/// <summary>
13791382
/// Finds the train that contains the wagons in the list.
13801383
/// Exact order is not required.
1381-
/// Some lists may only contain the first and last wagon.
1384+
/// Some lists may only contain the first and last wagon. Check that first and last wagon match with those two wagons in the activity list.
13821385
/// </summary>
13831386
/// <param name="wagonIdList"></param>
13841387
/// <returns>train or null</returns>
@@ -1393,9 +1396,13 @@ private Train matchesConsistNoOrder(List<string> wagonIdList)
13931396
{
13941397
nWagonListCars++;
13951398
}
1396-
if (nWagonListCars == trainItem.Cars.Count)
1399+
if (nWagonListCars == wagonIdList.Count)
13971400
{
1398-
return trainItem;
1401+
if (((wagonIdList[0] == trainItem.Cars[0].CarID) && (wagonIdList[wagonIdList.Count - 1] == trainItem.Cars[trainItem.Cars.Count - 1].CarID)) ||
1402+
((wagonIdList[0] == trainItem.Cars[trainItem.Cars.Count - 1].CarID) && (wagonIdList[wagonIdList.Count - 1] == trainItem.Cars[0].CarID)))
1403+
{
1404+
return trainItem;
1405+
}
13991406
}
14001407
}
14011408
}

0 commit comments

Comments
 (0)