From aebece3d89c533a9973b1552ac357f6744fab26a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 17 Nov 2018 15:18:22 +0900 Subject: [PATCH] Use already populated beatmap values if available --- osu.Game.Tournament/IPC/FileBasedIPC.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tournament/IPC/FileBasedIPC.cs b/osu.Game.Tournament/IPC/FileBasedIPC.cs index 9cc275e9e0..4bf2cfee38 100644 --- a/osu.Game.Tournament/IPC/FileBasedIPC.cs +++ b/osu.Game.Tournament/IPC/FileBasedIPC.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Logging; using osu.Framework.Platform.Windows; @@ -25,9 +26,8 @@ public class FileBasedIPC : MatchIPCInfo private int lastBeatmapId; [BackgroundDependencyLoader] - private void load() + private void load(LadderInfo ladder) { - StableStorage stable; try @@ -58,9 +58,17 @@ private void load() if (lastBeatmapId != beatmapId) { lastBeatmapId = beatmapId; - var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); - req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); - API.Queue(req); + + var existing = ladder.CurrentMatch.Value?.Grouping.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null); + + if (existing != null) + Beatmap.Value = existing.BeatmapInfo; + else + { + var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); + req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); + API.Queue(req); + } } Mods.Value = (LegacyMods)mods;