Skip to content

Commit 096ac98

Browse files
authored
Merge pull request #873 from cesarBLG/reduce-allocations
Reduce allocations in signal script
2 parents 370920e + cf0ed99 commit 096ac98

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/Orts.Simulation/Simulation/Signalling/CsSignalScript.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,9 @@ public string IdTextSignalAspect(int id, string sigfn, int headindex=0)
230230
var heads = SignalObjectById(id)?.SignalHeads;
231231
if (heads != null)
232232
{
233-
foreach (SignalHead head in heads.Where(head => head.Function == function))
233+
foreach (SignalHead head in heads)
234234
{
235+
if (head.Function != function) continue;
235236
if (headindex <= 0) return head.TextSignalAspect;
236237
headindex--;
237238
}

0 commit comments

Comments
 (0)