1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Add inline comment explaining why we are manually populating beatmap.BeatmapSet

This commit is contained in:
Dean Herbert 2021-11-04 13:45:59 +09:00
parent 9f9c960fe3
commit 0ab50f1cc9

View File

@ -645,12 +645,19 @@ namespace osu.Game.Online.Multiplayer
RoomUpdated?.Invoke();
GetOnlineBeatmapSet(settings.BeatmapID, cancellationToken).ContinueWith(set => Schedule(() =>
GetOnlineBeatmapSet(settings.BeatmapID, cancellationToken).ContinueWith(task => Schedule(() =>
{
if (cancellationToken.IsCancellationRequested)
return;
updatePlaylist(settings, set.Result);
APIBeatmapSet beatmapSet = task.Result;
// The incoming response is deserialised without circular reference handling currently.
// Because we require using metadata from this instance, populate the nested beatmaps' sets manually here.
foreach (var b in beatmapSet.Beatmaps)
b.BeatmapSet = beatmapSet;
updatePlaylist(settings, beatmapSet);
}), TaskContinuationOptions.OnlyOnRanToCompletion);
}, cancellationToken);
@ -664,7 +671,6 @@ namespace osu.Game.Online.Multiplayer
var beatmap = beatmapSet.Beatmaps.Single(b => b.OnlineID == settings.BeatmapID);
beatmap.Checksum = settings.BeatmapChecksum;
beatmap.BeatmapSet = beatmapSet;
var ruleset = Rulesets.GetRuleset(settings.RulesetID).CreateInstance();
var mods = settings.RequiredMods.Select(m => m.ToMod(ruleset));