-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix playlist total time not considering rate adjust mods #28399
Fix playlist total time not considering rate adjust mods #28399
Conversation
IEnumerable<Mod> modList = []; | ||
if (p.RequiredMods.Length > 0) | ||
{ | ||
var ruleset = p.Beatmap.Ruleset.CreateInstance(); | ||
modList = p.RequiredMods.Select(mod => mod.ToMod(ruleset)); | ||
} | ||
double rate = ModUtils.CalculateRateWithMods(modList); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created this validation to deal with the problem of instancing ruleset every time for every map
if (p.RequiredMods.Length > 0) | ||
{ | ||
var ruleset = p.Beatmap.Ruleset.CreateInstance(); | ||
rate = ModUtils.CalculateRateWithMods(p.RequiredMods.Select(mod => mod.ToMod(ruleset))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to work for wind up/down but I guess this is better than nothing for now.
…e present Regressed in ppy#28399. To reproduce, enter a playlist that has an item with a rate-changing mod (rather than create it yourself). This is happening because `APIRuleset` has `CreateInstance()` unimplemented: https://github.com/ppy/osu/blob/b4cefe0cc2fda0ab4b5af6138ee158bd32262f9a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs#L159 and only triggers when the playlist items in question originate from web. This is why it is bad to have interface implementations throw outside of maybe mock implementations for tests. `CreateInstance()` is a scourge elsewhere in general, we need way less of it in the codebase (because while convenient, it's also problematic to implement in online contexts, and also expensive because reflection).
Closes #28398