mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 13:23:22 +08:00
Fill out GetModsFor()
xmldoc and annotate items as non-null
This commit is contained in:
parent
e74b563b91
commit
30382b0445
@ -522,6 +522,8 @@ namespace osu.Game
|
|||||||
foreach (ModType type in Enum.GetValues(typeof(ModType)))
|
foreach (ModType type in Enum.GetValues(typeof(ModType)))
|
||||||
{
|
{
|
||||||
dict[type] = instance.GetModsFor(type)
|
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)
|
.Where(mod => mod != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,15 @@ namespace osu.Game.Rulesets
|
|||||||
return AllMods.FirstOrDefault(m => m is T)?.CreateInstance() as T;
|
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);
|
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user