-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store maximum statistics to spectator state #21587
Merged
peppy
merged 5 commits into
ppy:master
from
smoogipoo:spectatorstate-maximum-statistics
Dec 12, 2022
Merged
Store maximum statistics to spectator state #21587
peppy
merged 5 commits into
ppy:master
from
smoogipoo:spectatorstate-maximum-statistics
Dec 12, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bdach
reviewed
Dec 11, 2022
/// Scoring values for a perfect play. | ||
/// </summary> | ||
public ScoringValues MaximumScoringValues | ||
public Dictionary<HitResult, int> MaximumStatistics | ||
{ | ||
get | ||
{ | ||
if (!beatmapApplied) | ||
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}."); | |
throw new InvalidOperationException($"Cannot access maximum statistics before calling {nameof(ApplyBeatmap)}."); |
{ | ||
get | ||
{ | ||
if (!beatmapApplied) | ||
throw new InvalidOperationException($"Cannot access maximum scoring values before calling {nameof(ApplyBeatmap)}."); | ||
|
||
return maximumScoringValues; | ||
return maximumResultCounts.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing that a full copy of the dictionary was intended here (to get a fresh reference). If that was the case, you can also write
Suggested change
return maximumResultCounts.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); | |
return new Dictionary<HitResult, int>(maximumResultCounts); |
This was referenced Dec 12, 2022
peppy
approved these changes
Dec 12, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change which will need a new
osu-server-spectator
deploy.Storing the maximum scoring values was a mistake. In order to eventually construct replays server-side, we need to have the full statistics - basically everything that
ScoreInfo
/SoloScoreInfo
needs to compute score.