1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Add the ability to pass a CancellationToken through DifficultyCalculator.CalculateAll

Was weirdly missing from this one method.
This commit is contained in:
Dean Herbert 2021-12-07 13:32:35 +09:00
parent a62beb3c59
commit f3e9fb76fc

View File

@ -120,14 +120,14 @@ namespace osu.Game.Rulesets.Difficulty
/// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap. /// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap.
/// </summary> /// </summary>
/// <returns>A collection of structures describing the difficulty of the beatmap for each mod combination.</returns> /// <returns>A collection of structures describing the difficulty of the beatmap for each mod combination.</returns>
public IEnumerable<DifficultyAttributes> CalculateAll() public IEnumerable<DifficultyAttributes> CalculateAll(CancellationToken cancellationToken = default)
{ {
foreach (var combination in CreateDifficultyAdjustmentModCombinations()) foreach (var combination in CreateDifficultyAdjustmentModCombinations())
{ {
if (combination is MultiMod multi) if (combination is MultiMod multi)
yield return Calculate(multi.Mods); yield return Calculate(multi.Mods, cancellationToken);
else else
yield return Calculate(combination.Yield()); yield return Calculate(combination.Yield(), cancellationToken);
} }
} }