mirror of
https://github.com/ppy/osu.git
synced 2025-02-28 03:15:08 +08:00
Remove test-specific logic from RulesetConfigCache
This commit is contained in:
parent
77da1e12d5
commit
8094b502cb
@ -1,10 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets.Configuration;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
@ -40,10 +42,11 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
|
||||
{
|
||||
if (!IsLoaded)
|
||||
throw new InvalidOperationException($@"Cannot retrieve {nameof(IRulesetConfigManager)} before {nameof(RulesetConfigCache)} has loaded");
|
||||
|
||||
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);
|
||||
throw new InvalidOperationException($@"Attempted to retrieve {nameof(IRulesetConfigManager)} for an unavailable ruleset {ruleset.GetDisplayString()}");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user