1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:52:54 +08:00

AudioEquals method for BeatmapInfo.

This commit is contained in:
Huo Yaoyuan 2016-11-07 21:52:23 +08:00
parent d1f64cfbfc
commit c59cad2478
3 changed files with 11 additions and 10 deletions

View File

@ -120,7 +120,7 @@ namespace osu.Game.Beatmaps
public void TransferTo(WorkingBeatmap working)
{
if (track != null && working.BeatmapInfo.Metadata.AudioFile == BeatmapInfo.Metadata.AudioFile && working.BeatmapInfo.BeatmapSet.Path == BeatmapInfo.BeatmapSet.Path)
if (track != null && BeatmapInfo.AudioEquals(working.BeatmapInfo))
working.track = track;
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Database
[ManyToOne]
public BeatmapSetInfo BeatmapSet { get; set; }
[ForeignKey(typeof(BeatmapMetadata))]
public int BeatmapMetadataID { get; set; }
@ -29,9 +29,9 @@ namespace osu.Game.Database
[OneToOne(CascadeOperations = CascadeOperation.All)]
public BaseDifficulty BaseDifficulty { get; set; }
public string Path { get; set; }
// General
public int AudioLeadIn { get; set; }
public bool Countdown { get; set; }
@ -41,7 +41,7 @@ namespace osu.Game.Database
public PlayMode Mode { get; set; }
public bool LetterboxInBreaks { get; set; }
public bool WidescreenStoryboard { get; set; }
// Editor
// This bookmarks stuff is necessary because DB doesn't know how to store int[]
public string StoredBookmarks { get; internal set; }
@ -61,13 +61,15 @@ namespace osu.Game.Database
public int BeatDivisor { get; set; }
public int GridSize { get; set; }
public double TimelineZoom { get; set; }
// Metadata
public string Version { get; set; }
public bool Equals(BeatmapInfo other)
{
return BeatmapID == other?.BeatmapID;
}
}
public bool AudioEquals(BeatmapInfo other) => BeatmapSet.Path == other.BeatmapSet.Path && Metadata.AudioFile == other.Metadata.AudioFile;
}
}
}

View File

@ -221,8 +221,7 @@ namespace osu.Game.Overlays
{
if (playHistoryIndex >= 0)
{
BeatmapInfo stackHead = playHistory[playHistoryIndex];
if (beatmap.BeatmapSet.Path == stackHead.BeatmapSet.Path && beatmap.Metadata.AudioFile == stackHead.Metadata.AudioFile)
if (beatmap.AudioEquals(playHistory[playHistoryIndex]))
return;
if (playHistoryIndex < playHistory.Count - 1)
playHistory.RemoveRange(playHistoryIndex + 1, playHistory.Count - playHistoryIndex - 1);