mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 11:02:54 +08:00
Revert "Update mod instantiaton utility method to no longer check for validity"
This reverts commit 1a04260807
.
This commit is contained in:
parent
1a04260807
commit
83189d1f07
@ -153,17 +153,31 @@ namespace osu.Game.Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns an instantiated list of all proposed mods on a given ruleset.
|
/// Verifies all proposed mods are valid for a given ruleset and returns instantiated <see cref="Mod"/>s for further processing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset to instantiate mods.</param>
|
/// <param name="ruleset">The ruleset to verify mods against.</param>
|
||||||
/// <param name="proposedMods">The proposed mods.</param>
|
/// <param name="proposedMods">The proposed mods.</param>
|
||||||
/// <param name="mods">Mods instantiated from <paramref name="proposedMods"/> on the given <paramref name="ruleset"/>.</param>
|
/// <param name="valid">Mods instantiated from <paramref name="proposedMods"/> which were valid for the given <paramref name="ruleset"/>.</param>
|
||||||
public static void InstantiateModsForRuleset(Ruleset ruleset, IEnumerable<APIMod> proposedMods, out List<Mod> mods)
|
/// <returns>Whether all <paramref name="proposedMods"/> were valid for the given <paramref name="ruleset"/>.</returns>
|
||||||
|
public static bool InstantiateValidModsForRuleset(Ruleset ruleset, IEnumerable<APIMod> proposedMods, out List<Mod> valid)
|
||||||
{
|
{
|
||||||
mods = new List<Mod>();
|
valid = new List<Mod>();
|
||||||
|
bool proposedWereValid = true;
|
||||||
|
|
||||||
foreach (var apiMod in proposedMods)
|
foreach (var apiMod in proposedMods)
|
||||||
mods.Add(apiMod.ToMod(ruleset));
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// will throw if invalid
|
||||||
|
valid.Add(apiMod.ToMod(ruleset));
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
proposedWereValid = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return proposedWereValid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user