mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 14:12:56 +08:00
Give the placeholder ruleset better defaults to allow tests to work again
This commit is contained in:
parent
a0e2106468
commit
381174e482
@ -51,7 +51,12 @@ namespace osu.Game.Beatmaps
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public BeatmapInfo() // TODO: consider removing this and migrating all usages to ctor with parameters.
|
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();
|
Difficulty = new BeatmapDifficulty();
|
||||||
Metadata = new BeatmapMetadata();
|
Metadata = new BeatmapMetadata();
|
||||||
}
|
}
|
||||||
@ -149,20 +154,17 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
#region Compatibility properties
|
#region Compatibility properties
|
||||||
|
|
||||||
private int rulesetID;
|
|
||||||
|
|
||||||
[Ignored]
|
[Ignored]
|
||||||
[IgnoreMap]
|
[IgnoreMap]
|
||||||
public int RulesetID
|
public int RulesetID
|
||||||
{
|
{
|
||||||
// ReSharper disable once ConstantConditionalAccessQualifier
|
get => Ruleset.OnlineID;
|
||||||
get => Ruleset?.OnlineID ?? rulesetID;
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Ruleset != null)
|
if (!string.IsNullOrEmpty(Ruleset.InstantiationInfo))
|
||||||
throw new InvalidOperationException($"Cannot set a {nameof(RulesetID)} when {nameof(Ruleset)} is non-null");
|
throw new InvalidOperationException($"Cannot set a {nameof(RulesetID)} when {nameof(Ruleset)} is already set to an actual ruleset.");
|
||||||
|
|
||||||
rulesetID = value;
|
Ruleset.OnlineID = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user