diff --git a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/VisibleLineVerticesQuery.cs b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/VisibleLineVerticesQuery.cs index ca575be2..47250c2d 100644 --- a/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/VisibleLineVerticesQuery.cs +++ b/OngekiFumenEditor/Modules/FumenVisualEditor/Graphics/Drawing/TargetImpl/VisibleLineVerticesQuery.cs @@ -129,12 +129,13 @@ void CheckIfSoflanChanged2(double totalTGrid, bool isVailed) } //optimze vertices - for (var i = 0; i < tempVertices.Count - 3; i++) + var idx = 0; + for (; idx < tempVertices.Count - 3; idx++) { - var a1 = tempVertices[i]; - var a2 = tempVertices[i + 1]; - var b1 = tempVertices[i + 2]; - var b2 = tempVertices[i + 3]; + var a1 = tempVertices[idx]; + var a2 = tempVertices[idx + 1]; + var b1 = tempVertices[idx + 2]; + var b2 = tempVertices[idx + 3]; if (!(a1 == b1 && a2 == b2)) outVertices.Add(a1); @@ -142,16 +143,16 @@ void CheckIfSoflanChanged2(double totalTGrid, bool isVailed) if ((a1.Point.X == a2.Point.X && a2.Point.X == b1.Point.X) || (a1.Point.Y == a2.Point.Y && a2.Point.Y == b1.Point.Y)) { outVertices.Add(b1); - i += 2; + idx += 2; } else if (a1.Point == a2.Point) { - i += 1; + idx += 1; } } //add remain vertices - outVertices.AddRange(tempVertices.Skip(tempVertices.Count - 3)); + outVertices.AddRange(tempVertices.Skip(idx)); ObjectPool>.Return(affectedSoflanPoints); ObjectPool>.Return(tempVertices);