mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Remove Func<T>'d-ness.
This commit is contained in:
parent
41824e0179
commit
0a385055dc
@ -56,7 +56,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
/// <param name="time">The time to find the timing control point at.</param>
|
||||
/// <returns>The timing control point.</returns>
|
||||
public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, () => TimingPoints[0]);
|
||||
public TimingControlPoint TimingPointAt(double time) => binarySearch(TimingPoints, time, TimingPoints.FirstOrDefault());
|
||||
|
||||
/// <summary>
|
||||
/// Finds the maximum BPM represented by any timing control point.
|
||||
@ -81,16 +81,16 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </summary>
|
||||
/// <param name="list">The list to search.</param>
|
||||
/// <param name="time">The time to find the control point at.</param>
|
||||
/// <param name="prePoint">The control point to use when <paramref name="time"/> is before any control points.</param>
|
||||
/// <param name="prePoint">The control point to use when <paramref name="time"/> is before any control points. If null, a new control point will be constructed.</param>
|
||||
/// <returns>The active control point at <paramref name="time"/>.</returns>
|
||||
private T binarySearch<T>(SortedList<T> list, double time, Func<T> prePoint = null)
|
||||
private T binarySearch<T>(SortedList<T> list, double time, T prePoint = null)
|
||||
where T : ControlPoint, new()
|
||||
{
|
||||
if (list.Count == 0)
|
||||
return new T();
|
||||
|
||||
if (time < list[0].Time)
|
||||
return prePoint?.Invoke() ?? new T();
|
||||
return prePoint ?? new T();
|
||||
|
||||
int index = list.BinarySearch(new T() { Time = time });
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user