@@ -4107,9 +4107,7 @@ public void DisconnectBrakes()
41074107 {
41084108 if (SpeedMpS < -.1 || SpeedMpS > .1)
41094109 return;
4110- int first = -1;
4111- int last = -1;
4112- FindLeadLocomotives(ref first, ref last);
4110+ FindLeadLocomotives(out int first, out int last);
41134111 for (int i = 0; i < Cars.Count; i++)
41144112 {
41154113 Cars[i].BrakeSystem.FrontBrakeHoseConnected = first < i && i <= last;
@@ -4150,9 +4148,7 @@ public void SetRetainers(bool increase)
41504148 break;
41514149 }
41524150 }
4153- int first = -1;
4154- int last = -1;
4155- FindLeadLocomotives(ref first, ref last);
4151+ FindLeadLocomotives(out int first, out int last);
41564152 int step = 100 / RetainerPercent;
41574153 for (int i = 0; i < Cars.Count; i++)
41584154 {
@@ -4175,7 +4171,7 @@ public void SetRetainers(bool increase)
41754171 // for example a double headed steam locomotive will most often have a tender separating the two locomotives,
41764172 // so the second locomotive will not be identified, nor will a locomotive added at the rear of the train.
41774173
4178- public void FindLeadLocomotives(ref int first, ref int last)
4174+ public void FindLeadLocomotives(out int first, out int last)
41794175 {
41804176 first = last = -1;
41814177 if (LeadLocomotiveIndex >= 0)
@@ -4215,9 +4211,7 @@ public void FindLeadLocomotives(ref int first, ref int last)
42154211
42164212 public TrainCar FindLeadLocomotive()
42174213 {
4218- int first = -1;
4219- int last = -1;
4220- FindLeadLocomotives(ref first, ref last);
4214+ FindLeadLocomotives(out int first, out int last);
42214215 if (first != -1 && first < LeadLocomotiveIndex)
42224216 {
42234217 return Cars[first];
0 commit comments