Replace spectator-local fix for wrong ruleset ID with player-global consistency check

This commit is contained in:
Bartłomiej Dach 2021-10-16 16:06:20 +02:00
parent b34086a792
commit 874decb3cd
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497
2 changed files with 7 additions and 3 deletions

View File

@ -144,9 +144,9 @@ namespace osu.Game.Online.Spectator
IsPlaying = true; IsPlaying = true;
// transfer state at point of beginning play // transfer state at point of beginning play
currentState.BeatmapID = state.Beatmap.BeatmapInfo.OnlineBeatmapID; currentState.BeatmapID = score.ScoreInfo.BeatmapInfo.OnlineBeatmapID;
currentState.RulesetID = state.Ruleset.RulesetInfo.ID; currentState.RulesetID = score.ScoreInfo.RulesetID;
currentState.Mods = state.Mods.Select(m => new APIMod(m)).ToArray(); currentState.Mods = score.ScoreInfo.Mods.Select(m => new APIMod(m)).ToArray();
currentBeatmap = state.Beatmap; currentBeatmap = state.Beatmap;
currentScore = score; currentScore = score;

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -217,9 +218,12 @@ namespace osu.Game.Screens.Play
Score = CreateScore(playableBeatmap); Score = CreateScore(playableBeatmap);
Debug.Assert(ruleset.RulesetInfo.ID != null);
// ensure the score is in a consistent state with the current player. // ensure the score is in a consistent state with the current player.
Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo; Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo;
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo; Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
Score.ScoreInfo.RulesetID = ruleset.RulesetInfo.ID.Value;
Score.ScoreInfo.Mods = gameplayMods; Score.ScoreInfo.Mods = gameplayMods;
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score)); dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));