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

Mention safety failures of Beatmap/Score constructors

This commit is contained in:
Dean Herbert 2022-01-10 13:25:23 +09:00
parent c831e9107a
commit 83ccbc1d13
2 changed files with 14 additions and 1 deletions

View File

@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps
}
[UsedImplicitly]
public BeatmapInfo()
public BeatmapInfo() // TODO: this bypasses null safeties. needs to be hidden from user api (only should be used by realm).
{
}

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Localisation;
using osu.Framework.Testing;
@ -44,6 +45,18 @@ namespace osu.Game.Scoring
[MapTo("User")]
public RealmUser RealmUser { get; set; } = null!;
public ScoreInfo(BeatmapInfo beatmap, RulesetInfo ruleset, RealmUser user)
{
Ruleset = ruleset;
Beatmap = beatmap;
RealmUser = user;
}
[UsedImplicitly]
public ScoreInfo() // TODO: this bypasses null safeties. needs to be hidden from user api (only should be used by realm).
{
}
// TODO: this is a bit temporary to account for the fact that this class is used to ferry API user data to certain UI components.
// Eventually we should either persist enough information to realm to not require the API lookups, or perform the API lookups locally.
private APIUser? user;