1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Addressed code quality issues

This commit is contained in:
Aurelian 2024-05-24 09:30:24 +02:00
parent 481883801f
commit fff52be59a
2 changed files with 15 additions and 11 deletions

View File

@ -71,12 +71,12 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
[Test]
[Timeout(4000)] //Catches crashes in other threads, but not ideal. Hopefully there is a improvement to this.
public void TestScalingSliderFlat(
[Values(0, 1, 2, 3)] int type_int
[Values(0, 1, 2, 3)] int typeInt
)
{
Slider slider = null;
Slider slider = null!;
switch (type_int)
switch (typeInt)
{
case 0:
AddStep("Add linear slider", () =>
@ -93,6 +93,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
EditorBeatmap.Add(slider);
});
break;
case 1:
AddStep("Add perfect curve slider", () =>
{
@ -109,14 +110,15 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
EditorBeatmap.Add(slider);
});
break;
case 2:
AddStep("Add bezier slider", () =>
case 3:
AddStep("Add catmull slider", () =>
{
slider = new Slider { StartTime = EditorClock.CurrentTime, Position = new Vector2(300) };
PathControlPoint[] points =
{
new PathControlPoint(new Vector2(0), PathType.BEZIER),
new PathControlPoint(new Vector2(0), PathType.CATMULL),
new PathControlPoint(new Vector2(50, 25)),
new PathControlPoint(new Vector2(25, 80)),
new PathControlPoint(new Vector2(40, 100)),
@ -126,14 +128,15 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
EditorBeatmap.Add(slider);
});
break;
case 3:
AddStep("Add catmull slider", () =>
default:
AddStep("Add bezier slider", () =>
{
slider = new Slider { StartTime = EditorClock.CurrentTime, Position = new Vector2(300) };
PathControlPoint[] points =
{
new PathControlPoint(new Vector2(0), PathType.CATMULL),
new PathControlPoint(new Vector2(0), PathType.BEZIER),
new PathControlPoint(new Vector2(50, 25)),
new PathControlPoint(new Vector2(25, 80)),
new PathControlPoint(new Vector2(40, 100)),

View File

@ -274,9 +274,9 @@ namespace osu.Game.Rulesets.Objects
/// </summary>
/// <para>
/// The angle is first obtained based on the farthest vector from the first,
/// then we find the angle of each vector from the first,
/// then we find the angle of each vector from the first,
/// and calculate the distance between the two angle vectors.
/// We than scale this distance to the distance from the first vector
/// We than scale this distance to the distance from the first vector
/// (or by 10 if the distance is smaller),
/// and if it is greater than acceptableDifference, we return false.
/// </para>
@ -288,6 +288,7 @@ namespace osu.Game.Rulesets.Objects
Vector2 farthest = vectors.MaxBy(x => Vector2.Distance(first, x));
Vector2 angle = Vector2.Normalize(farthest - first);
foreach (Vector2 vector in vectors)
{
if (vector == first)