1
0
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:
Bartłomiej Dach 2021-12-23 19:27:27 +01:00
parent 77da1e12d5
commit 8094b502cb
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -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;
}