Skip to content

Commit 71e57d2

Browse files
status in Work Orders popup set too fast, see https://bugs.launchpad.net/or/+bug/2118776
1 parent ade0195 commit 71e57d2

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

Source/Orts.Simulation/Simulation/Activity.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,33 +1376,28 @@ private Train matchesConsist(List<string> wagonIdList)
13761376
return null;
13771377
}
13781378
/// <summary>
1379-
/// Finds the train that contains exactly the wagons (and maybe loco) in the list. Exact order is not required.
1379+
/// Finds the train that contains exactly the wagons in the list. Exact order is not required.
13801380
/// </summary>
13811381
/// <param name="wagonIdList"></param>
13821382
/// <returns>train or null</returns>
13831383
private Train matchesConsistNoOrder(List<string> wagonIdList)
13841384
{
13851385
foreach (var trainItem in Simulator.Trains)
13861386
{
1387-
int nCars = 0;//all cars other than WagonIdList.
1388-
int nWagonListCars = 0;//individual wagon drop.
1387+
int nWagonListCars = 0;
13891388
foreach (var item in trainItem.Cars)
13901389
{
1391-
if (!wagonIdList.Contains(item.CarID)) nCars++;
1392-
if (wagonIdList.Contains(item.CarID)) nWagonListCars++;
1393-
}
1394-
// Compare two lists to make sure wagons are present.
1395-
bool listsMatch = true;
1396-
//support individual wagonIdList drop
1397-
if (trainItem.Cars.Count - nCars == (wagonIdList.Count == nWagonListCars ? wagonIdList.Count : nWagonListCars))
1398-
{
1399-
if (excludesWagons(trainItem, wagonIdList)) listsMatch = false;//all wagons dropped
1400-
1401-
if (listsMatch) return trainItem;
1402-
1390+
if (wagonIdList.Contains(item.CarID))
1391+
{
1392+
nWagonListCars++;
1393+
}
1394+
if (nWagonListCars == trainItem.Cars.Count)
1395+
{
1396+
return trainItem;
1397+
}
14031398
}
1404-
14051399
}
1400+
14061401
return null;
14071402
}
14081403
/// <summary>

0 commit comments

Comments
 (0)