Skip to content

Commit

Permalink
Use Slice method instead of index range operators for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
frenzibyte committed Mar 18, 2024
1 parent a11e63b commit a8ce6a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,16 @@ private PathControlPoint[] convertPathString(string pointString, Vector2 offset)
{
int startIndex = segmentsBuffer[i].StartIndex;
int endIndex = segmentsBuffer[i + 1].StartIndex;
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints[startIndex..endIndex], pointsBuffer[endIndex]));
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints.Slice(startIndex, endIndex - startIndex), pointsBuffer[endIndex]));
}
else
{
int startIndex = segmentsBuffer[i].StartIndex;
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints[startIndex..], null));
controlPoints.AddRange(convertPoints(segmentsBuffer[i].Type, allPoints.Slice(startIndex), null));
}
}

return mergePointsLists(controlPoints);
return mergeControlPointsLists(controlPoints);
}
finally
{
Expand Down Expand Up @@ -402,7 +402,7 @@ static bool isLinear(Vector2 p0, Vector2 p1, Vector2 p2)
- (p1.X - p0.X) * (p2.Y - p0.Y));
}

private PathControlPoint[] mergePointsLists(List<ArraySegment<PathControlPoint>> controlPointList)
private PathControlPoint[] mergeControlPointsLists(List<ArraySegment<PathControlPoint>> controlPointList)
{
int totalCount = 0;

Expand Down

0 comments on commit a8ce6a0

Please sign in to comment.