Skip to content

Commit

Permalink
Merge pull request #19175 from frenzibyte/fix-solo-score-info-mod-set…
Browse files Browse the repository at this point in the history
…tings

Fix `SoloScoreInfo` not carrying mod settings in conversion methods
  • Loading branch information
peppy authored Jul 17, 2022
2 parents 5b9be3e + 9382636 commit 1cfa667
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion osu.Game/Online/API/APIMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ public Mod ToMod(Ruleset ruleset)
if (!Settings.TryGetValue(property.Name.Underscore(), out object settingValue))
continue;

resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
try
{
resultMod.CopyAdjustedSetting((IBindable)property.GetValue(resultMod), settingValue);
}
catch (Exception ex)
{
Logger.Log($"Failed to copy mod setting value '{settingValue ?? "null"}' to \"{property.Name}\": {ex.Message}");
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Online/API/Requests/Responses/SoloScoreInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public ScoreInfo ToScoreInfo(RulesetStore rulesets, BeatmapInfo? beatmap = null)

var rulesetInstance = ruleset.CreateInstance();

var mods = Mods.Select(apiMod => rulesetInstance.CreateModFromAcronym(apiMod.Acronym)).Where(m => m != null).ToArray();
var mods = Mods.Select(apiMod => apiMod.ToMod(rulesetInstance)).ToArray();

var scoreInfo = ToScoreInfo(mods);

Expand Down

0 comments on commit 1cfa667

Please sign in to comment.