mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Avoid LINQ overhead in PatternGenerator.isValid
This commit is contained in:
parent
16e60eed56
commit
03291e3897
@ -149,7 +149,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
{
|
||||
lowerBound ??= RandomStart;
|
||||
upperBound ??= TotalColumns;
|
||||
nextColumn ??= (_ => GetRandomColumn(lowerBound, upperBound));
|
||||
nextColumn ??= _ => GetRandomColumn(lowerBound, upperBound);
|
||||
|
||||
// Check for the initial column
|
||||
if (isValid(initialColumn))
|
||||
@ -176,7 +176,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
|
||||
return initialColumn;
|
||||
|
||||
bool isValid(int column) => validation?.Invoke(column) != false && !patterns.Any(p => p.ColumnHasObject(column));
|
||||
bool isValid(int column)
|
||||
{
|
||||
if (validation?.Invoke(column) == false)
|
||||
return false;
|
||||
|
||||
foreach (var p in patterns)
|
||||
{
|
||||
if (p.ColumnHasObject(column))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user