1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:03:11 +08:00

Give the placeholder ruleset better defaults to allow tests to work again

This commit is contained in:
Dean Herbert 2022-01-17 14:40:00 +09:00
parent a0e2106468
commit 381174e482

View File

@ -51,7 +51,12 @@ namespace osu.Game.Beatmaps
[UsedImplicitly]
public BeatmapInfo() // TODO: consider removing this and migrating all usages to ctor with parameters.
{
Ruleset = new RulesetInfo();
Ruleset = new RulesetInfo
{
OnlineID = 0,
ShortName = @"osu",
Name = @"null placeholder ruleset"
};
Difficulty = new BeatmapDifficulty();
Metadata = new BeatmapMetadata();
}
@ -149,20 +154,17 @@ namespace osu.Game.Beatmaps
#region Compatibility properties
private int rulesetID;
[Ignored]
[IgnoreMap]
public int RulesetID
{
// ReSharper disable once ConstantConditionalAccessQualifier
get => Ruleset?.OnlineID ?? rulesetID;
get => Ruleset.OnlineID;
set
{
if (Ruleset != null)
throw new InvalidOperationException($"Cannot set a {nameof(RulesetID)} when {nameof(Ruleset)} is non-null");
if (!string.IsNullOrEmpty(Ruleset.InstantiationInfo))
throw new InvalidOperationException($"Cannot set a {nameof(RulesetID)} when {nameof(Ruleset)} is already set to an actual ruleset.");
rulesetID = value;
Ruleset.OnlineID = value;
}
}