1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Fill out GetModsFor() xmldoc and annotate items as non-null

This commit is contained in:
Bartłomiej Dach 2022-06-15 17:26:54 +02:00
parent e74b563b91
commit 30382b0445
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 11 additions and 0 deletions

View File

@ -522,6 +522,8 @@ namespace osu.Game
foreach (ModType type in Enum.GetValues(typeof(ModType)))
{
dict[type] = instance.GetModsFor(type)
// Rulesets should never return null mods, but let's be defensive just in case.
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
.Where(mod => mod != null)
.ToList();
}

View File

@ -93,6 +93,15 @@ namespace osu.Game.Rulesets
return AllMods.FirstOrDefault(m => m is T)?.CreateInstance() as T;
}
/// <summary>
/// Creates an enumerable with mods that are supported by the ruleset for the supplied <paramref name="type"/>.
/// </summary>
/// <remarks>
/// If there are no applicable mods from the given <paramref name="type"/> in this ruleset,
/// then the proper behaviour is to return an empty enumerable.
/// <see langword="null"/> mods should not be present in the returned enumerable.
/// </remarks>
[ItemNotNull]
public abstract IEnumerable<Mod> GetModsFor(ModType type);
/// <summary>