mirror of
https://github.com/ppy/osu
synced 2024-12-27 17:32:56 +00:00
Update null fallback cases involving OnlineID
This commit is contained in:
parent
37673f4cf8
commit
213d89b479
@ -237,7 +237,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
createPlayerTest(false, r =>
|
||||
{
|
||||
var beatmap = createTestBeatmap(r);
|
||||
beatmap.BeatmapInfo.OnlineID = null;
|
||||
beatmap.BeatmapInfo.OnlineID = -1;
|
||||
return beatmap;
|
||||
});
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("import beatmap", () =>
|
||||
{
|
||||
importedBeatmap = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely();
|
||||
importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineID ?? -1;
|
||||
importedBeatmapId = importedBeatmap.Beatmaps.First(b => b.RulesetID == 0).OnlineID;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
importedSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely();
|
||||
importedBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0);
|
||||
importedBeatmapId = importedBeatmap.OnlineID ?? -1;
|
||||
importedBeatmapId = importedBeatmap.OnlineID;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
foreach (int user in users)
|
||||
{
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID ?? 0);
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID);
|
||||
multiplayerUsers.Add(OnlinePlayDependencies.Client.AddUser(new APIUser { Id = user }, true));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
foreach (int user in users)
|
||||
{
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID ?? 0);
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineID);
|
||||
var roomUser = OnlinePlayDependencies.Client.AddUser(new APIUser { Id = user }, true);
|
||||
|
||||
roomUser.MatchState = new TeamVersusUserState
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
PlaylistItem playlistItem = new PlaylistItem
|
||||
{
|
||||
BeatmapID = beatmapInfo.OnlineID ?? -1,
|
||||
BeatmapID = beatmapInfo.OnlineID,
|
||||
};
|
||||
|
||||
Stack.Push(screen = new MultiplayerResultsScreen(score, 1, playlistItem));
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
PlaylistItem playlistItem = new PlaylistItem
|
||||
{
|
||||
BeatmapID = beatmapInfo.OnlineID ?? -1,
|
||||
BeatmapID = beatmapInfo.OnlineID,
|
||||
};
|
||||
|
||||
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
|
||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
if (beatmapSet.OnlineID != null)
|
||||
{
|
||||
beatmapSet.OnlineID = null;
|
||||
beatmapSet.OnlineID = -1;
|
||||
LogForModel(beatmapSet, "Disassociating beatmap set ID due to loss of all beatmap IDs");
|
||||
}
|
||||
}
|
||||
@ -122,9 +122,9 @@ namespace osu.Game.Beatmaps
|
||||
Delete(existingSetWithSameOnlineID);
|
||||
|
||||
// in order to avoid a unique key constraint, immediately remove the online ID from the previous set.
|
||||
existingSetWithSameOnlineID.OnlineID = null;
|
||||
existingSetWithSameOnlineID.OnlineID = -1;
|
||||
foreach (var b in existingSetWithSameOnlineID.Beatmaps)
|
||||
b.OnlineID = null;
|
||||
b.OnlineID = -1;
|
||||
|
||||
LogForModel(beatmapSet, $"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineID}). It has been deleted.");
|
||||
}
|
||||
@ -159,7 +159,7 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
}
|
||||
|
||||
void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineID = null);
|
||||
void resetIds() => beatmapSet.Beatmaps.ForEach(b => b.OnlineID = -1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
void fail(Exception e)
|
||||
{
|
||||
beatmapInfo.OnlineID = null;
|
||||
beatmapInfo.OnlineID = -1;
|
||||
logForModel(set, $"Online retrieval failed for {beatmapInfo} ({e.Message})");
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
if (string.IsNullOrEmpty(beatmapInfo.MD5Hash)
|
||||
&& string.IsNullOrEmpty(beatmapInfo.Path)
|
||||
&& beatmapInfo.OnlineID == null)
|
||||
&& beatmapInfo.OnlineID <= 0)
|
||||
return false;
|
||||
|
||||
try
|
||||
@ -175,7 +175,7 @@ namespace osu.Game.Beatmaps
|
||||
cmd.CommandText = "SELECT beatmapset_id, beatmap_id, approved, user_id FROM osu_beatmaps WHERE checksum = @MD5Hash OR beatmap_id = @OnlineID OR filename = @Path";
|
||||
|
||||
cmd.Parameters.Add(new SqliteParameter("@MD5Hash", beatmapInfo.MD5Hash));
|
||||
cmd.Parameters.Add(new SqliteParameter("@OnlineID", beatmapInfo.OnlineID ?? (object)DBNull.Value));
|
||||
cmd.Parameters.Add(new SqliteParameter("@OnlineID", beatmapInfo.OnlineID));
|
||||
cmd.Parameters.Add(new SqliteParameter("@Path", beatmapInfo.Path));
|
||||
|
||||
using (var reader = cmd.ExecuteReader())
|
||||
|
@ -133,8 +133,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
writer.WriteLine(FormattableString.Invariant($"Version: {beatmap.BeatmapInfo.DifficultyName}"));
|
||||
if (!string.IsNullOrEmpty(beatmap.Metadata.Source)) writer.WriteLine(FormattableString.Invariant($"Source: {beatmap.Metadata.Source}"));
|
||||
if (!string.IsNullOrEmpty(beatmap.Metadata.Tags)) writer.WriteLine(FormattableString.Invariant($"Tags: {beatmap.Metadata.Tags}"));
|
||||
if (beatmap.BeatmapInfo.OnlineID != null) writer.WriteLine(FormattableString.Invariant($"BeatmapID: {beatmap.BeatmapInfo.OnlineID}"));
|
||||
if (beatmap.BeatmapInfo.BeatmapSet?.OnlineID != null) writer.WriteLine(FormattableString.Invariant($"BeatmapSetID: {beatmap.BeatmapInfo.BeatmapSet.OnlineID}"));
|
||||
if (beatmap.BeatmapInfo.OnlineID > 0) writer.WriteLine(FormattableString.Invariant($"BeatmapID: {beatmap.BeatmapInfo.OnlineID}"));
|
||||
if (beatmap.BeatmapInfo.BeatmapSet?.OnlineID > 0) writer.WriteLine(FormattableString.Invariant($"BeatmapSetID: {beatmap.BeatmapInfo.BeatmapSet.OnlineID}"));
|
||||
}
|
||||
|
||||
private void handleDifficulty(TextWriter writer)
|
||||
|
@ -238,8 +238,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
if (editRequested != null)
|
||||
items.Add(new OsuMenuItem("Edit", MenuItemType.Standard, () => editRequested(beatmapInfo)));
|
||||
|
||||
if (beatmapInfo.OnlineID.HasValue && beatmapOverlay != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID.Value)));
|
||||
if (beatmapInfo.OnlineID > 0 && beatmapOverlay != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(beatmapInfo.OnlineID)));
|
||||
|
||||
if (collectionManager != null)
|
||||
{
|
||||
|
@ -240,7 +240,7 @@ namespace osu.Game.Stores
|
||||
ArtistUnicode = decoded.Metadata.ArtistUnicode,
|
||||
Author =
|
||||
{
|
||||
OnlineID = decoded.Metadata.Author.Id,
|
||||
OnlineID = decoded.Metadata.Author.OnlineID,
|
||||
Username = decoded.Metadata.Author.Username
|
||||
},
|
||||
Source = decoded.Metadata.Source,
|
||||
@ -254,7 +254,7 @@ namespace osu.Game.Stores
|
||||
{
|
||||
Hash = hash,
|
||||
DifficultyName = decodedInfo.DifficultyName,
|
||||
OnlineID = decodedInfo.OnlineID ?? -1,
|
||||
OnlineID = decodedInfo.OnlineID,
|
||||
AudioLeadIn = decodedInfo.AudioLeadIn,
|
||||
StackLeniency = decodedInfo.StackLeniency,
|
||||
SpecialStyle = decodedInfo.SpecialStyle,
|
||||
|
Loading…
Reference in New Issue
Block a user