1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add more xmldoc and avoid BeatmapSet status being set when it shouldn't be

This commit is contained in:
Dean Herbert 2022-08-02 12:12:02 +09:00
parent 0fcae08d38
commit 4adc8375e9
2 changed files with 10 additions and 3 deletions

View File

@ -11,6 +11,10 @@ namespace osu.Game.Beatmaps
{
public enum BeatmapOnlineStatus
{
/// <summary>
/// This is a special status given when local changes are made via the editor.
/// Once in this state, online status changes should be ignored unless the beatmap is reverted or submitted.
/// </summary>
[Description("Local")]
LocallyModified = -4,

View File

@ -51,6 +51,9 @@ namespace osu.Game.Beatmaps
/// <summary>
/// Queue an update for a beatmap set.
/// </summary>
/// <remarks>
/// This may happen during initial import, or at a later stage in response to a user action or server event.
/// </remarks>
/// <param name="beatmapSet">The beatmap set to update. Updates will be applied directly (so a transaction should be started if this instance is managed).</param>
/// <param name="preferOnlineFetch">Whether metadata from an online source should be preferred. If <c>true</c>, the local cache will be skipped to ensure the freshest data state possible.</param>
public void Update(BeatmapSetInfo beatmapSet, bool preferOnlineFetch)
@ -94,15 +97,15 @@ namespace osu.Game.Beatmaps
beatmapInfo.LastOnlineUpdate = res.LastUpdated;
beatmapInfo.Metadata.Author.OnlineID = res.AuthorID;
Debug.Assert(beatmapInfo.BeatmapSet != null);
// In the case local changes have been applied, don't reset the status.
if (beatmapInfo.MatchesOnlineVersion || beatmapInfo.Status != BeatmapOnlineStatus.LocallyModified)
{
beatmapInfo.Status = res.Status;
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
}
Debug.Assert(beatmapInfo.BeatmapSet != null);
beatmapInfo.BeatmapSet.Status = res.BeatmapSet?.Status ?? BeatmapOnlineStatus.None;
beatmapInfo.BeatmapSet.OnlineID = res.OnlineBeatmapSetID;
beatmapInfo.BeatmapSet.DateRanked = res.BeatmapSet?.Ranked;
beatmapInfo.BeatmapSet.DateSubmitted = res.BeatmapSet?.Submitted;