restructured StarResult to unify modes
This commit is contained in:
+2
-4
@@ -13,7 +13,7 @@ impl OsuAttributeProvider for DifficultyAttributes {
|
||||
|
||||
impl OsuAttributeProvider for StarResult {
|
||||
fn attributes(self) -> Option<DifficultyAttributes> {
|
||||
if let Self::Osu { attributes } = self {
|
||||
if let Self::Osu(attributes) = self {
|
||||
Some(attributes)
|
||||
} else {
|
||||
None
|
||||
@@ -235,9 +235,7 @@ impl<'m> OsuPP<'m> {
|
||||
.powf(1.0 / 1.1)
|
||||
* multiplier;
|
||||
|
||||
let attributes = StarResult::Osu {
|
||||
attributes: self.attributes.unwrap(),
|
||||
};
|
||||
let attributes = StarResult::Osu(self.attributes.unwrap());
|
||||
|
||||
PpResult { pp, attributes }
|
||||
}
|
||||
|
||||
@@ -27,13 +27,11 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
let od = (80.0 - hitwindow) / 6.0;
|
||||
|
||||
if take < 2 {
|
||||
return StarResult::Osu {
|
||||
attributes: DifficultyAttributes {
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
return StarResult::Osu(DifficultyAttributes {
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
let section_len = SECTION_LEN * attributes.clock_rate;
|
||||
@@ -127,7 +125,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
n_spinners: 0, // TODO
|
||||
};
|
||||
|
||||
StarResult::Osu { attributes }
|
||||
StarResult::Osu(attributes)
|
||||
}
|
||||
|
||||
// TODO: strains function
|
||||
|
||||
@@ -47,9 +47,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
};
|
||||
|
||||
if take < 2 {
|
||||
return StarResult::Osu {
|
||||
attributes: diff_attributes,
|
||||
};
|
||||
return StarResult::Osu(diff_attributes);
|
||||
}
|
||||
|
||||
let section_len = SECTION_LEN * map_attributes.clock_rate;
|
||||
@@ -148,9 +146,7 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
diff_attributes.speed_strain = speed_strain;
|
||||
diff_attributes.aim_strain = aim_strain;
|
||||
|
||||
StarResult::Osu {
|
||||
attributes: diff_attributes,
|
||||
}
|
||||
StarResult::Osu(diff_attributes)
|
||||
}
|
||||
|
||||
/// Essentially the same as the `stars` function but instead of
|
||||
|
||||
@@ -39,13 +39,11 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
let od = (80.0 - hitwindow) / 6.0;
|
||||
|
||||
if take < 2 {
|
||||
return StarResult::Osu {
|
||||
attributes: DifficultyAttributes {
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
..Default::default()
|
||||
},
|
||||
};
|
||||
return StarResult::Osu(DifficultyAttributes {
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
let section_len = SECTION_LEN * attributes.clock_rate;
|
||||
@@ -163,18 +161,16 @@ pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> S
|
||||
|
||||
let stars = aim_strain + speed_strain + (aim_strain - speed_strain).abs() / 2.0;
|
||||
|
||||
StarResult::Osu {
|
||||
attributes: DifficultyAttributes {
|
||||
stars,
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
speed_strain,
|
||||
aim_strain,
|
||||
max_combo,
|
||||
n_circles,
|
||||
n_spinners,
|
||||
},
|
||||
}
|
||||
StarResult::Osu(DifficultyAttributes {
|
||||
stars,
|
||||
ar: attributes.ar,
|
||||
od,
|
||||
speed_strain,
|
||||
aim_strain,
|
||||
max_combo,
|
||||
n_circles,
|
||||
n_spinners,
|
||||
})
|
||||
}
|
||||
|
||||
/// Essentially the same as the `stars` function but instead of
|
||||
|
||||
Reference in New Issue
Block a user