|
10 | 10 | using Dapper; |
11 | 11 | using McMaster.Extensions.CommandLineUtils; |
12 | 12 | using MySqlConnector; |
| 13 | +using osu.Game.Extensions; |
13 | 14 | using osu.Server.QueueProcessor; |
14 | 15 | using osu.Server.Queues.ScoreStatisticsProcessor.Helpers; |
15 | 16 | using osu.Server.Queues.ScoreStatisticsProcessor.Models; |
@@ -155,6 +156,9 @@ private static void formatOutput(SoloScore score, bool delete, string reason) |
155 | 156 | ); |
156 | 157 | } |
157 | 158 |
|
| 159 | + private static readonly HashSet<string> a_hash_set = new HashSet<string>(); |
| 160 | + private static readonly HashSet<string> b_hash_set = new HashSet<string>(); |
| 161 | + |
158 | 162 | private static bool checkIsUserHigh(IEnumerable<SoloScore> userScores, SoloScore candidate, out HashSet<SoloScore> preservedAlternatives) |
159 | 163 | { |
160 | 164 | var scores = userScores.Where(s => |
@@ -200,11 +204,22 @@ private static bool checkIsUserHigh(IEnumerable<SoloScore> userScores, SoloScore |
200 | 204 |
|
201 | 205 | static bool compareMods(SoloScore a, SoloScore b) |
202 | 206 | { |
203 | | - // Compare non-ordered mods, ignoring any settings applied. |
204 | | - var aMods = new HashSet<string>(a.ScoreData.Mods.Select(m => m.Acronym)); |
205 | | - var bMods = new HashSet<string>(b.ScoreData.Mods.Select(m => m.Acronym)); |
| 207 | + var aMods = a.ScoreData.Mods; |
| 208 | + var bMods = b.ScoreData.Mods; |
| 209 | + |
| 210 | + if (aMods.Length == 0 && bMods.Length == 0) |
| 211 | + return true; |
| 212 | + |
| 213 | + if (aMods.Length != bMods.Length) |
| 214 | + return false; |
| 215 | + |
| 216 | + a_hash_set.Clear(); |
| 217 | + a_hash_set.AddRange(aMods.Select(m => m.Acronym)); |
| 218 | + |
| 219 | + b_hash_set.Clear(); |
| 220 | + b_hash_set.AddRange(bMods.Select(m => m.Acronym)); |
206 | 221 |
|
207 | | - return aMods.SetEquals(bMods); |
| 222 | + return a_hash_set.SetEquals(b_hash_set); |
208 | 223 | } |
209 | 224 | } |
210 | 225 | } |
|
0 commit comments