Fix and refactor star difficulty calculation boilerplate

Moves star difficulty calculation entry-point to Beatmap, and sets
star difficulty at the correct place for song select to display.
This commit is contained in:
Thomas Müller
2017-02-24 19:36:17 +01:00
parent edbd27210b
commit f7d985fe18
9 changed files with 20 additions and 22 deletions

View File

@ -73,7 +73,6 @@ namespace osu.Game.Database
// Metadata
public string Version { get; set; }
//todo: background threaded computation of this
private float starDifficulty = -1;
public float StarDifficulty
{
@ -85,11 +84,6 @@ namespace osu.Game.Database
set { starDifficulty = value; }
}
internal void ComputeDifficulty(BeatmapDatabase database)
{
StarDifficulty = (float)Ruleset.GetRuleset(Mode).CreateDifficultyCalculator(database.GetWorkingBeatmap(this).Beatmap).GetDifficulty();
}
public bool Equals(BeatmapInfo other)
{
return ID == other?.ID;