diff --git a/osu.Game/Rulesets/RulesetConfigCache.cs b/osu.Game/Rulesets/RulesetConfigCache.cs index aeac052673..262340b4ee 100644 --- a/osu.Game/Rulesets/RulesetConfigCache.cs +++ b/osu.Game/Rulesets/RulesetConfigCache.cs @@ -19,7 +19,7 @@ public class RulesetConfigCache : Component private readonly RealmContextFactory realmFactory; private readonly RulesetStore rulesets; - private readonly Dictionary configCache = new Dictionary(); + private readonly Dictionary configCache = new Dictionary(); public RulesetConfigCache(RealmContextFactory realmFactory, RulesetStore rulesets) { @@ -36,10 +36,10 @@ protected override void LoadComplete() // let's keep things simple for now and just retrieve all the required configs at startup.. foreach (var ruleset in rulesets.AvailableRulesets) { - if (ruleset.ID == null) + if (string.IsNullOrEmpty(ruleset.ShortName)) continue; - configCache[ruleset.ID.Value] = ruleset.CreateInstance().CreateConfig(settingsStore); + configCache[ruleset.ShortName] = ruleset.CreateInstance().CreateConfig(settingsStore); } } @@ -51,10 +51,7 @@ protected override void LoadComplete() /// If doesn't have a valid . public IRulesetConfigManager GetConfigFor(Ruleset ruleset) { - if (ruleset.RulesetInfo.ID == null) - return null; - - if (!configCache.TryGetValue(ruleset.RulesetInfo.ID.Value, out var config)) + if (!configCache.TryGetValue(ruleset.RulesetInfo.ShortName, out var config)) // any ruleset request which wasn't initialised on startup should not be stored to realm. // this should only be used by tests. return ruleset.CreateConfig(null);