Skip to content

Commit

Permalink
fix: consider set_on_lazer for serialized scores
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxOhn committed Nov 26, 2024
1 parent 9bc787c commit 6855f89
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/model/score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl<'de> Deserialize<'de> for Score {
#[derive(Deserialize)]
#[cfg_attr(feature = "deny_unknown_fields", serde(deny_unknown_fields))]
struct ScoreRawMods {
set_on_lazer: Option<bool>, // used for serialized score; not sent by osu!
#[serde(default, rename = "classic_total_score")]
classic_score: u32, // not available in legacy scores
ranked: Option<bool>,
Expand Down Expand Up @@ -160,7 +161,9 @@ impl<'de> Deserialize<'de> for Score {
}

let score_raw = <ScoreRawMods as serde::Deserialize>::deserialize(d)?;
let set_on_stable = score_raw.legacy_score > 0;
let set_on_stable = score_raw
.set_on_lazer
.map_or(score_raw.legacy_score > 0, |b| !b);

Ok(Score {
set_on_lazer: !set_on_stable,
Expand Down

0 comments on commit 6855f89

Please sign in to comment.