mirror of
https://github.com/ppy/osu
synced 2024-12-12 18:07:52 +00:00
Use Ruleset
's ShortName
for mod caching purposes
This commit is contained in:
parent
1020fb7323
commit
377ba2673a
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets
|
||||
{
|
||||
public RulesetInfo RulesetInfo { get; internal set; }
|
||||
|
||||
private static readonly ConcurrentDictionary<int, IMod[]> mod_reference_cache = new ConcurrentDictionary<int, IMod[]>();
|
||||
private static readonly ConcurrentDictionary<string, IMod[]> mod_reference_cache = new ConcurrentDictionary<string, IMod[]>();
|
||||
|
||||
/// <summary>
|
||||
/// A queryable source containing all available mods.
|
||||
@ -49,11 +49,8 @@ namespace osu.Game.Rulesets
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!(RulesetInfo.ID is int id))
|
||||
return CreateAllMods();
|
||||
|
||||
if (!mod_reference_cache.TryGetValue(id, out var mods))
|
||||
mod_reference_cache[id] = mods = CreateAllMods().Cast<IMod>().ToArray();
|
||||
if (!mod_reference_cache.TryGetValue(ShortName, out var mods))
|
||||
mod_reference_cache[ShortName] = mods = CreateAllMods().Cast<IMod>().ToArray();
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user