Skip to content

Commit 63ab5b1

Browse files
committed
Remove duplicate loops.
1 parent 92b426e commit 63ab5b1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Source/Contrib/ContentManager/Models/Consist.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,10 @@ public Consist(Content content)
4444
var WagCount = 0;
4545
var Separator = ""; // when set, indicates that subsequent engines are in a separate block
4646

47-
Cars = from car in file.Train.TrainCfg.WagonList
48-
select new Car(car);
49-
47+
var CarList = new List<Car>();
5048
foreach (Wagon wag in file.Train.TrainCfg.WagonList)
5149
{
50+
CarList.Add(new Car(wag));
5251
if (wag.IsEngine)
5352
{
5453
EngCount++;
@@ -65,6 +64,7 @@ public Consist(Content content)
6564
if (EngCount > 0) { NumEngines = NumEngines + Separator + EngCount.ToString(); }
6665
if (NumEngines == null) { NumEngines = "0"; }
6766
NumCars = WagCount.ToString();
67+
Cars = CarList;
6868
}
6969
}
7070

0 commit comments

Comments
 (0)