From 10162f8f10c325c780ee40f1cac78fae12e473bc Mon Sep 17 00:00:00 2001 From: MaxOhn Date: Fri, 10 Nov 2023 15:01:09 +0100 Subject: [PATCH] fix: move state conversions --- src/gradual.rs | 60 ---------------------------------------------- src/score_state.rs | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/gradual.rs b/src/gradual.rs index 277e87c7..32ee0c74 100644 --- a/src/gradual.rs +++ b/src/gradual.rs @@ -168,66 +168,6 @@ impl Iterator for OwnedGradualDifficulty { } } -impl From for ScoreState { - #[inline] - fn from(state: OsuScoreState) -> Self { - Self { - max_combo: state.max_combo, - n_geki: 0, - n_katu: 0, - n300: state.n300, - n100: state.n100, - n50: state.n50, - n_misses: state.n_misses, - } - } -} - -impl From for ScoreState { - #[inline] - fn from(state: TaikoScoreState) -> Self { - Self { - max_combo: state.max_combo, - n_geki: 0, - n_katu: 0, - n300: state.n300, - n100: state.n100, - n50: 0, - n_misses: state.n_misses, - } - } -} - -impl From for ScoreState { - #[inline] - fn from(state: CatchScoreState) -> Self { - Self { - max_combo: state.max_combo, - n_geki: 0, - n_katu: state.n_tiny_droplet_misses, - n300: state.n_fruits, - n100: state.n_droplets, - n50: state.n_tiny_droplets, - n_misses: state.n_misses, - } - } -} - -impl From for ScoreState { - #[inline] - fn from(state: ManiaScoreState) -> Self { - Self { - max_combo: 0, - n_geki: state.n320, - n_katu: state.n200, - n300: state.n300, - n100: state.n100, - n50: state.n50, - n_misses: state.n_misses, - } - } -} - /// Gradually calculate the performance attributes on maps of any mode. /// /// After each hit object you can call [`next`](`GradualPerformance::next`) diff --git a/src/score_state.rs b/src/score_state.rs index 01c59327..13df36ec 100644 --- a/src/score_state.rs +++ b/src/score_state.rs @@ -108,3 +108,63 @@ impl From for ManiaScoreState { } } } + +impl From for ScoreState { + #[inline] + fn from(state: OsuScoreState) -> Self { + Self { + max_combo: state.max_combo, + n_geki: 0, + n_katu: 0, + n300: state.n300, + n100: state.n100, + n50: state.n50, + n_misses: state.n_misses, + } + } +} + +impl From for ScoreState { + #[inline] + fn from(state: TaikoScoreState) -> Self { + Self { + max_combo: state.max_combo, + n_geki: 0, + n_katu: 0, + n300: state.n300, + n100: state.n100, + n50: 0, + n_misses: state.n_misses, + } + } +} + +impl From for ScoreState { + #[inline] + fn from(state: CatchScoreState) -> Self { + Self { + max_combo: state.max_combo, + n_geki: 0, + n_katu: state.n_tiny_droplet_misses, + n300: state.n_fruits, + n100: state.n_droplets, + n50: state.n_tiny_droplets, + n_misses: state.n_misses, + } + } +} + +impl From for ScoreState { + #[inline] + fn from(state: ManiaScoreState) -> Self { + Self { + max_combo: 0, + n_geki: state.n320, + n_katu: state.n200, + n300: state.n300, + n100: state.n100, + n50: state.n50, + n_misses: state.n_misses, + } + } +}