1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 09:02:58 +08:00

Add default Beatmap ID

This commit is contained in:
柯十六夜 2016-12-21 14:47:56 +08:00
parent 02f6e46105
commit ef11c3f389
5 changed files with 11 additions and 16 deletions

View File

@ -69,15 +69,9 @@ namespace osu.Game.Database
using (var reader = ArchiveReader.GetReader(storage, path))
metadata = reader.ReadMetadata();
if (metadata.BeatmapSetID != -1)
{
if (connection.Table<BeatmapSetInfo>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
return; // TODO: Update this beatmap instead
}
else
{
// TODO: Another method is required to determine whether two beatmaps with no BeatmapSetID are equal.
}
if (metadata.BeatmapSetID != -1 &&
connection.Table<BeatmapSetInfo>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
return; // TODO: Update this beatmap instead
if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
{

View File

@ -16,9 +16,9 @@ namespace osu.Game.Database
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public int BeatmapID { get; set; }
public int BeatmapID { get; set; } = 0;
public int BeatmapSetID { get; set; }
public int BeatmapSetID { get; set; } = -1;
[ForeignKey(typeof(BeatmapSetInfo))]
public int BeatmapSetInfoID { get; set; }
@ -75,7 +75,7 @@ namespace osu.Game.Database
public bool Equals(BeatmapInfo other)
{
return BeatmapID == other?.BeatmapID;
return ID == other?.ID;
}
public bool AudioEquals(BeatmapInfo other) => other != null &&

View File

@ -9,8 +9,9 @@ namespace osu.Game.Database
{
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public int BeatmapSetID { get; set; }
public int BeatmapSetID { get; set; } = -1;
public string Title { get; set; }
public string TitleUnicode { get; set; }
public string Artist { get; set; }

View File

@ -13,7 +13,7 @@ namespace osu.Game.Database
[PrimaryKey, AutoIncrement]
public int ID { get; set; }
public int BeatmapSetID { get; set; }
public int BeatmapSetID { get; set; } = -1;
[OneToOne(CascadeOperations = CascadeOperation.All)]
public BeatmapMetadata Metadata { get; set; }

View File

@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
{
if (beatmap.BeatmapSetID == Beatmap?.BeatmapInfo.BeatmapSetID)
if (beatmap.BeatmapSetInfoID == Beatmap?.BeatmapInfo.BeatmapSetInfoID)
sampleChangeDifficulty.Play();
else
{