mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Optimise mania density calculation during beatmap conversion
This commit is contained in:
parent
d563de0e54
commit
145530035c
@ -119,14 +119,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
yield return obj;
|
||||
}
|
||||
|
||||
private readonly List<double> prevNoteTimes = new List<double>(max_notes_for_density);
|
||||
private readonly LimitedCapacityQueue<double> prevNoteTimes = new LimitedCapacityQueue<double>(max_notes_for_density);
|
||||
private double density = int.MaxValue;
|
||||
|
||||
private void computeDensity(double newNoteTime)
|
||||
{
|
||||
if (prevNoteTimes.Count == max_notes_for_density)
|
||||
prevNoteTimes.RemoveAt(0);
|
||||
prevNoteTimes.Add(newNoteTime);
|
||||
prevNoteTimes.Enqueue(newNoteTime);
|
||||
|
||||
if (prevNoteTimes.Count >= 2)
|
||||
density = (prevNoteTimes[^1] - prevNoteTimes[0]) / prevNoteTimes.Count;
|
||||
|
Loading…
Reference in New Issue
Block a user