Skip to content

Commit

Permalink
Should not validate the object in here because status should be valid…
Browse files Browse the repository at this point in the history
… after re-assign the value in the beatmap processor.
  • Loading branch information
andy840119 committed Mar 26, 2023
1 parent bd55c98 commit 4cef74e
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions osu.Game.Rulesets.Karaoke/Beatmaps/KaraokeBeatmapProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ private void applyInvalidProperty(IBeatmap beatmap)
foreach (var flag in lyric.WorkingPropertyValidator.GetAllInvalidFlags())
{
applyInvalidProperty(lyric, flag);
lyric.WorkingPropertyValidator.Validate(flag);
}

break;
Expand All @@ -45,7 +44,6 @@ private void applyInvalidProperty(IBeatmap beatmap)
foreach (var flag in note.WorkingPropertyValidator.GetAllInvalidFlags())
{
applyInvalidProperty(note, flag);
note.WorkingPropertyValidator.Validate(flag);
}

break;
Expand All @@ -63,10 +61,7 @@ private void applyInvalidProperty(Lyric lyric, LyricWorkingProperty flag)
break;

case LyricWorkingProperty.ReferenceLyric:
if (lyric.ReferenceLyric != null || lyric.ReferenceLyricId == null)
return;

lyric.ReferenceLyric = findLyricById(lyric.ReferenceLyricId.Value);
lyric.ReferenceLyric = findLyricById(lyric.ReferenceLyricId);
break;

default:
Expand All @@ -84,19 +79,16 @@ private void applyInvalidProperty(Note note, NoteWorkingProperty flag)
break;

case NoteWorkingProperty.ReferenceLyric:
if (note.ReferenceLyric != null || note.ReferenceLyricId == null)
return;

note.ReferenceLyric = findLyricById(note.ReferenceLyricId.Value);
note.ReferenceLyric = findLyricById(note.ReferenceLyricId);
break;

default:
throw new ArgumentOutOfRangeException();
}
}

private Lyric findLyricById(int id) =>
Beatmap.HitObjects.OfType<Lyric>().Single(x => x.ID == id);
private Lyric? findLyricById(int? id) =>
id == null ? null : Beatmap.HitObjects.OfType<Lyric>().Single(x => x.ID == id);

public override void PostProcess()
{
Expand Down

0 comments on commit 4cef74e

Please sign in to comment.