Skip to content

Commit aac64c4

Browse files
committed
prefer Enumerable.Range()
1 parent 01a5cec commit aac64c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/TrainControlSystem.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
using System.Collections.Generic;
3030
using System.IO;
3131
using System.Diagnostics;
32+
using System.Linq;
3233
using ORTS.Scripting.Api.ETCS;
3334

3435
namespace Orts.Simulation.RollingStocks.SubSystems
@@ -1131,7 +1132,7 @@ private void UpdateETCSPlanning()
11311132
float maxDistanceAheadM = 0;
11321133
ETCSStatus.SpeedTargets.Clear();
11331134
ETCSStatus.SpeedTargets.Add(new PlanningTarget(0, CurrentSpeedLimitMpS));
1134-
for (int i=0; i<5; i++)
1135+
foreach (int i in Enumerable.Range(0, 5))
11351136
{
11361137
maxDistanceAheadM = NextSignalDistanceM(i);
11371138
if (NextSignalAspect(i) == Aspect.Stop || NextSignalAspect(i) == Aspect.None) break;
@@ -1140,7 +1141,7 @@ private void UpdateETCSPlanning()
11401141
}
11411142
float prevDist = 0;
11421143
float prevSpeed = 0;
1143-
for (int i=0; i<10; i++)
1144+
foreach (int i in Enumerable.Range(0, 10))
11441145
{
11451146
float distanceM = NextPostDistanceM(i);
11461147
if (distanceM >= maxDistanceAheadM) break;

0 commit comments

Comments
 (0)