From c6816a6cf3f638b5ee031280f6be7b1c9e79c4e9 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 17 Jul 2018 17:00:28 +0900 Subject: [PATCH 1/3] Fix potential quadratic complexity in taiko autoplay --- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index cea59c3fea..7dd50ab8b8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -88,7 +88,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring AddJudgement(new TaikoStrongHitJudgement()); break; case DrumRoll drumRoll: - for (int i = 0; i < drumRoll.NestedHitObjects.OfType().Count(); i++) + var count = drumRoll.NestedHitObjects.OfType().Count(); + for (int i = 0; i < count; i++) { AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); From 4e72794101d75c52b93acd1659d52079d5128b2b Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 15:55:38 +0200 Subject: [PATCH 2/3] Converts float to int. --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 48512a71c2..1b6c6f5ce8 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -41,14 +41,14 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); + result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1])); + var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); CurveType curveType = CurveType.Catmull; double length = 0; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime + offset); + result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); } if (result == null) From 9eb69a1e768848ab304b5134d8f3ca8fcfde098a Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 17:47:55 +0200 Subject: [PATCH 3/3] Restructure + corrects converting to support all systems --- .../Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 1b6c6f5ce8..dc1cd5ed3b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Objects.Legacy { string[] split = text.Split(','); + Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture)); + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax; bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); type &= ~ConvertHitObjectType.NewCombo; @@ -41,15 +43,13 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); + result = CreateHit(pos, combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); - CurveType curveType = CurveType.Catmull; double length = 0; var points = new List { Vector2.Zero }; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); + result = CreateHold(pos, combo, endTime + offset); } if (result == null)