1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Add nullability directive and make variant non-nullable

This commit is contained in:
Dean Herbert 2021-09-15 17:09:02 +09:00
parent 15e3f95c87
commit a150fb2996
3 changed files with 9 additions and 6 deletions

View File

@ -5,6 +5,8 @@ using System;
using osu.Game.Database;
using Realms;
#nullable enable
namespace osu.Game.Configuration
{
[MapTo(@"RulesetSetting")]
@ -16,12 +18,13 @@ namespace osu.Game.Configuration
[Indexed]
public int RulesetID { get; set; }
public int? Variant { get; set; }
[Indexed]
public int Variant { get; set; }
public string Key { get; set; }
public string Key { get; set; } = string.Empty;
[MapTo(nameof(Value))]
public string ValueString { get; set; }
public string ValueString { get; set; } = string.Empty;
public object Value
{

View File

@ -465,7 +465,7 @@ namespace osu.Game
ValueString = dkb.StringValue,
Key = dkb.Key,
RulesetID = dkb.RulesetID.Value,
Variant = dkb.Variant
Variant = dkb.Variant ?? 0,
});
}
}

View File

@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Configuration
{
private readonly RealmContextFactory realmFactory;
private readonly int? variant;
private readonly int variant;
private List<RealmRulesetSetting> databasedSettings = new List<RealmRulesetSetting>();
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Configuration
rulesetId = ruleset.ID ?? -1;
this.variant = variant;
this.variant = variant ?? 0;
Load();