Skip to content

Commit

Permalink
Merge pull request #476 from LumpBloom7/fix-slide-mirror-corruption
Browse files Browse the repository at this point in the history
Fix valid slide part list being corrupted when using mirror mod
  • Loading branch information
LumpBloom7 authored Aug 16, 2023
2 parents f2a33f4 + 3ceca2b commit f7c6012
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Sentakki/Mods/SentakkiModMirror.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public void ApplyToBeatmap(IBeatmap beatmap)
{
foreach (var slideInfo in slide.SlideInfoList)
{
foreach (var part in slideInfo.SlidePathParts)
for (int i = 0; i < slideInfo.SlidePathParts.Length; ++i)
{
ref var part = ref slideInfo.SlidePathParts[i];
part.EndOffset = (part.EndOffset * -1).NormalizePath();
part.Mirrored ^= mirrored;
}
Expand Down
10 changes: 1 addition & 9 deletions osu.Game.Rulesets.Sentakki/Objects/SlidePathPart.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;

namespace osu.Game.Rulesets.Sentakki.Objects
{
public class SlideBodyPart : IEquatable<SlideBodyPart>
public record struct SlideBodyPart
{
public SlidePaths.PathShapes Shape { get; private set; }
public int EndOffset { get; set; }
Expand All @@ -14,11 +12,5 @@ public SlideBodyPart(SlidePaths.PathShapes shape, int endOffset, bool mirrored)
EndOffset = endOffset;
Mirrored = mirrored;
}

public override bool Equals(object? obj) => obj is not null && obj is SlideBodyPart otherPart && Equals(otherPart);

public bool Equals(SlideBodyPart? other) => other is not null && (ReferenceEquals(this, other) || (Shape == other.Shape && EndOffset == other.EndOffset));

public override int GetHashCode() => HashCode.Combine(Shape, EndOffset, Mirrored);
}
}

0 comments on commit f7c6012

Please sign in to comment.