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(); RoomUpdated?.Invoke();
GetOnlineBeatmapSet(settings.BeatmapID, cancellationToken).ContinueWith(set => Schedule(() => GetOnlineBeatmapSet(settings.BeatmapID, cancellationToken).ContinueWith(task => Schedule(() =>
{ {
if (cancellationToken.IsCancellationRequested) if (cancellationToken.IsCancellationRequested)
return; 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); }), TaskContinuationOptions.OnlyOnRanToCompletion);
}, cancellationToken); }, cancellationToken);
@ -664,7 +671,6 @@ namespace osu.Game.Online.Multiplayer
var beatmap = beatmapSet.Beatmaps.Single(b => b.OnlineID == settings.BeatmapID); var beatmap = beatmapSet.Beatmaps.Single(b => b.OnlineID == settings.BeatmapID);
beatmap.Checksum = settings.BeatmapChecksum; beatmap.Checksum = settings.BeatmapChecksum;
beatmap.BeatmapSet = beatmapSet;
var ruleset = Rulesets.GetRuleset(settings.RulesetID).CreateInstance(); var ruleset = Rulesets.GetRuleset(settings.RulesetID).CreateInstance();
var mods = settings.RequiredMods.Select(m => m.ToMod(ruleset)); var mods = settings.RequiredMods.Select(m => m.ToMod(ruleset));