1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 09:30:08 +08:00
Commit Graph

24 Commits

Author SHA1 Message Date
Dean Herbert
1814a325d8 Move GetSettingUnderlyingValue to a SettingSource extension method 2022-03-15 14:54:00 +09:00
Dan Balasescu
c61397cc22 Fix whitespace/inspection 2022-03-10 16:22:27 +09:00
Dean Herbert
0267aed846 Change ToMod to return an UnknownMod rather than throw if a mod isn't available
As seen by this kind of crash, having the `.ToMod` method throw can be
very problematic and also hidden (as it is used inside of models in
places where exceptions are not expected to occur).

Given there are tens of usages of this method, returning a placeholder
mod seems like a better idea than outright throwing.

```
 An unhandled has occurred.
 System.InvalidOperationException:
There is no mod in the ruleset (osu) matching the acronym AS.
 at osu.Game.Online.API.APIMod.ToMod(Ruleset ruleset) in /Users/dean/Projects/osu/osu.Game/Online/API/APIMod.cs:line 54
 at osu.Game.Scoring.ScoreInfo.<get_Mods>b__117_0(APIMod m) in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at System.Linq.Enumerable.SelectArrayIterator`2.ToArray()
 at osu.Game.Scoring.ScoreInfo.get_Mods() in /Users/dean/Projects/osu/osu.Game/Scoring/ScoreInfo.cs:line 193
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c.<subscribeToLocalScores>b__40_2(ScoreInfo s) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line 199
 at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
 at osu.Game.Database.RealmObjectExtensions.Detach[T](IEnumerable`1 items) in /Users/dean/Projects/osu/osu.Game/Database/RealmObjectExtensions.cs:line 180
 at osu.Game.Screens.Select.Leaderboards.BeatmapLeaderboard.<>c__DisplayClass40_0.<subscribeToLocalScores>g__localScoresChanged|1(IRealmCollection`1 sender, ChangeSet changes, Exception exception) in /Users/dean/Projects/osu/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs:line
209
 at Realms.RealmCollectionBase`1.Realms.INotifiable<Realms.NotifiableObjectHandleBase.CollectionChangeSet>.NotifyCallbacks(Nullable`1 changes, Nullable`1 exception)
 at Realms.NotifiableObjectHandleBase.NotifyObjectChanged(IntPtr managedHandle, IntPtr changes, IntPtr exception)
```
2022-03-09 17:57:55 +09:00
Dan Balasescu
2acaffd5e7 Fix APIMod storing bindables instead of value 2022-02-24 17:01:12 +09:00
Dean Herbert
76e877f160 Disable APIMod/Mod cross equality support 2021-09-10 11:24:56 +09:00
Dean Herbert
cf633973a9 Refactor exposed mod retrieval methods for better safety 2021-09-10 11:09:13 +09:00
Dean Herbert
ce6b022a90 Remove unused IMod specification from APIMod 2021-09-10 10:59:30 +09:00
Dean Herbert
4d0530ca9d Add new methods to ruleset for quicker mod lookups 2021-09-09 16:46:14 +09:00
Dean Herbert
e66d76d26e Avoid settings copy if there are no settings 2021-09-09 15:43:55 +09:00
Salman Ahmed
92fab653e1 Take current mod settings value into account on equality comparsion 2021-04-12 20:51:13 +03:00
Salman Ahmed
18fb9f5ac9
Merge branch 'master' into mod-using-reference-equality 2021-04-11 19:48:55 +03:00
Dean Herbert
75f1ebd5f9 Add custom resolver for mod settings dictionary 2021-02-03 19:46:47 +09:00
Dean Herbert
e4fc604163 Setup all multiplayer model classes for MessagePack support 2021-01-26 16:26:03 +09:00
Dean Herbert
6ad1b7767e
Update osu.Game/Online/API/APIMod.cs
Co-authored-by: Salman Ahmed <slmanarendo1950@gmail.com>
2021-01-03 17:04:16 +09:00
Dean Herbert
99fa0e25dc Switch back to FirstOrDefault to allow for weird testing logic to pass 2021-01-03 16:46:24 +09:00
Dean Herbert
29dbb1cc0d Add internal pathway for ensuring correct application of bindable mods 2021-01-03 15:48:28 +09:00
Dean Herbert
23e216fa0b Simplify some default value checks (we are sure the return is an IBindable) 2021-01-03 15:47:15 +09:00
Dean Herbert
1a44338124 Use SingleOrDefault for added safety when looking up mod acronyms 2021-01-03 15:38:30 +09:00
Salman Ahmed
41b79d938b Fix wrong checks.. 2020-12-28 15:30:52 +03:00
Salman Ahmed
5efcdbd431 Fix IMod now using reference equality as well 2020-12-28 15:19:28 +03:00
Salman Ahmed
43f8f3638a Fix mod using reference equality unless casted to IMod 2020-12-27 02:42:13 +03:00
Dean Herbert
c834aa6051 Use APIMod for mod serialization 2020-10-22 17:48:15 +09:00
smoogipoo
03b61e4a5a Throw exception rather than returning nulls 2020-01-22 20:00:36 +09:00
smoogipoo
2bc7458abf Add mod setting (de)serialization support 2020-01-17 13:27:47 +09:00