Skip to content

Commit

Permalink
Fix bug causing SlideFan to still have twins
Browse files Browse the repository at this point in the history
  • Loading branch information
LumpBloom7 committed Jul 23, 2022
1 parent 9fc2865 commit cb207d9
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions osu.Game.Rulesets.Sentakki/Beatmaps/SentakkiBeatmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private IEnumerable<SentakkiHitObject> convertSlider(HitObject original)
// See if we can convert to a slide object
if (special && slider.Duration >= 350)
{
var result = tryConvertSliderToSlide(original, nodeSamples, twin, breakNote);
var result = tryConvertSliderToSlide(original, nodeSamples, twin, breakNote).ToList();
if (result.Any())
{
foreach (var ho in result)
Expand Down Expand Up @@ -193,29 +193,25 @@ private IEnumerable<SentakkiHitObject> tryConvertSliderToSlide(HitObject origina

slides.Add((Slide)createSlideNote(original, nodeSamples, false, isBreak));

// Perform sanitization pass
if (slides.Count == 2)
{
// If there is a SlideFan, we always prioritize that, and ignore the rest
foreach (var slide in slides)
if (slide.SlideInfoList[0].ID == SlidePaths.FANID)
{
yield return slide;
yield break;
}

// If both slides have the same start lane, we attempt to merge them
if (slides[0].Lane == slides[1].Lane)
// If there is a SlideFan, we always prioritize that, and ignore the rest
foreach (var slide in slides)
if (slide.SlideInfoList[0].ID == SlidePaths.FANID)
{
bool isSamePattern = slides[0].SlideInfoList[0].ID == slides[1].SlideInfoList[0].ID;
bool isSameOrientation = slides[0].SlideInfoList[0].Mirrored == slides[1].SlideInfoList[0].Mirrored;
yield return slide;
yield break;
}

// We merge both slides only if they both have the same pattern AND orientation
if (!isSamePattern || !isSameOrientation)
slides[0].SlideInfoList.AddRange(slides[1].SlideInfoList);
// If both slides have the same start lane, we attempt to merge them
if (slides.Count == 2 && slides[0].Lane == slides[1].Lane)
{
bool isSamePattern = slides[0].SlideInfoList[0].ID == slides[1].SlideInfoList[0].ID;
bool isSameOrientation = slides[0].SlideInfoList[0].Mirrored == slides[1].SlideInfoList[0].Mirrored;

slides.RemoveAt(1);
}
// We merge both slides only if they both have the same pattern AND orientation
if (!isSamePattern || !isSameOrientation)
slides[0].SlideInfoList.AddRange(slides[1].SlideInfoList);

slides.RemoveAt(1);
}

if (slides.Count > 0)
Expand Down

0 comments on commit cb207d9

Please sign in to comment.