renamed 'attributes' field to 'difficulty' for performance attributes

This commit is contained in:
MaxOhn
2021-11-21 04:15:41 +01:00
parent bdc2927963
commit df022ee428
11 changed files with 43 additions and 42 deletions
+4 -4
View File
@@ -477,7 +477,7 @@ pub struct OsuDifficultyAttributes {
#[derive(Clone, Debug, Default)]
pub struct OsuPerformanceAttributes {
/// The difficulty attributes that were used for the performance calculation
pub attributes: OsuDifficultyAttributes,
pub difficulty: OsuDifficultyAttributes,
/// The final performance points.
pub pp: f64,
/// The accuracy portion of the final pp.
@@ -494,7 +494,7 @@ impl OsuPerformanceAttributes {
/// Return the star value.
#[inline]
pub fn stars(&self) -> f64 {
self.attributes.stars
self.difficulty.stars
}
/// Return the performance point value.
@@ -506,13 +506,13 @@ impl OsuPerformanceAttributes {
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
self.difficulty.max_combo
}
}
impl From<OsuPerformanceAttributes> for OsuDifficultyAttributes {
fn from(attributes: OsuPerformanceAttributes) -> Self {
attributes.attributes
attributes.difficulty
}
}
+3 -3
View File
@@ -345,7 +345,7 @@ impl OsuPPInner {
* multiplier;
OsuPerformanceAttributes {
attributes: self.attributes,
difficulty: self.attributes,
pp_acc: acc_value,
pp_aim: aim_value,
pp_flashlight: flashlight_value,
@@ -607,7 +607,7 @@ impl OsuAttributeProvider for OsuDifficultyAttributes {
impl OsuAttributeProvider for OsuPerformanceAttributes {
#[inline]
fn attributes(self) -> Option<OsuDifficultyAttributes> {
Some(self.attributes)
Some(self.difficulty)
}
}
@@ -628,7 +628,7 @@ impl OsuAttributeProvider for PerformanceAttributes {
fn attributes(self) -> Option<OsuDifficultyAttributes> {
#[allow(irrefutable_let_patterns)]
if let Self::Osu(attributes) = self {
Some(attributes.attributes)
Some(attributes.difficulty)
} else {
None
}