Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix valid slide part list being corrupted when using mirror mod #476

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}