mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 17:02:55 +08:00
Check if path lists are empty
This commit is contained in:
parent
a9b45c6fdc
commit
73db68a49a
@ -261,14 +261,17 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
// The current vertex ends the segment
|
// The current vertex ends the segment
|
||||||
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
var segmentVertices = vertices.AsSpan().Slice(start, i - start + 1);
|
||||||
var segmentType = ControlPoints[start].Type ?? PathType.Linear;
|
var segmentType = ControlPoints[start].Type ?? PathType.Linear;
|
||||||
|
|
||||||
// No need to calculate path when there is only 1 vertex
|
// No need to calculate path when there is only 1 vertex
|
||||||
if (segmentVertices.Length == 1)
|
if (segmentVertices.Length == 1)
|
||||||
calculatedPath.Add(segmentVertices[0]);
|
calculatedPath.Add(segmentVertices[0]);
|
||||||
else if (segmentVertices.Length > 1)
|
else if (segmentVertices.Length > 1)
|
||||||
{
|
{
|
||||||
|
List<Vector2> subPath = calculateSubPath(segmentVertices, segmentType);
|
||||||
// Skip the first vertex if it is the same as the last vertex from the previous segment
|
// Skip the first vertex if it is the same as the last vertex from the previous segment
|
||||||
int skipFirst = calculatedPath.Last() == segmentVertices[0] ? 1 : 0;
|
int skipFirst = calculatedPath.Count > 0 && subPath.Count > 0 && calculatedPath.Last() == subPath[0] ? 1 : 0;
|
||||||
foreach (Vector2 t in calculateSubPath(segmentVertices, segmentType).Skip(skipFirst))
|
|
||||||
|
foreach (Vector2 t in subPath.Skip(skipFirst))
|
||||||
calculatedPath.Add(t);
|
calculatedPath.Add(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user