added max_combo method for all PerformanceAttributes structs

This commit is contained in:
MaxOhn
2021-11-21 03:44:28 +01:00
parent c6b0fc55a8
commit 13ef11a1f8
5 changed files with 53 additions and 4 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
- Fixed out of bounds panic on maps with single-control-point linear sliders
- [BREAKING] Added the field `TaikoDifficultyAttributes::max_combo`
- Added method `Beatmap::bpm`
- Added method `DifficultyAttributes::max_combo`
- Added method `max_combo` for `DifficultyAttributes`, `PerformanceAttributes`, and all `{Mode}PerformanceAttributes`
# v0.3.0
+6
View File
@@ -457,6 +457,12 @@ impl FruitsPerformanceAttributes {
pub fn pp(&self) -> f64 {
self.pp
}
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
}
}
impl From<FruitsPerformanceAttributes> for FruitsDifficultyAttributes {
+34 -3
View File
@@ -319,7 +319,7 @@ impl DifficultyAttributes {
}
}
/// The max combo of the map.
/// The maximum combo of the map.
///
/// This will only be `None` for attributes of osu!mania maps.
#[inline]
@@ -336,9 +336,9 @@ impl DifficultyAttributes {
}
}
/// The max combo of the map.
#[inline]
#[cfg(not(feature = "mania"))]
#[inline]
/// The maximum combo of the map.
pub fn max_combo(&self) -> usize {
match self {
#[cfg(feature = "fruits")]
@@ -441,6 +441,37 @@ impl PerformanceAttributes {
Self::Taiko(attributes) => DifficultyAttributes::Taiko(attributes.attributes),
}
}
#[cfg(feature = "mania")]
#[inline]
/// The maximum combo of the map.
///
/// This will only be `None` for attributes of osu!mania maps.
pub fn max_combo(&self) -> Option<usize> {
match self {
#[cfg(feature = "fruits")]
Self::Fruits(f) => Some(f.attributes.max_combo),
Self::Mania(_) => None,
#[cfg(feature = "osu")]
Self::Osu(o) => Some(o.attributes.max_combo),
#[cfg(feature = "taiko")]
Self::Taiko(t) => Some(t.attributes.max_combo),
}
}
#[cfg(not(feature = "mania"))]
#[inline]
/// The maximum combo of the map.
pub fn max_combo(&self) -> usize {
match self {
#[cfg(feature = "fruits")]
Self::Fruits(f) => f.attributes.max_combo,
#[cfg(feature = "osu")]
Self::Osu(o) => o.attributes.max_combo,
#[cfg(feature = "taiko")]
Self::Taiko(t) => t.attributes.max_combo,
}
}
}
impl From<PerformanceAttributes> for DifficultyAttributes {
+6
View File
@@ -502,6 +502,12 @@ impl OsuPerformanceAttributes {
pub fn pp(&self) -> f64 {
self.pp
}
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
}
}
impl From<OsuPerformanceAttributes> for OsuDifficultyAttributes {
+6
View File
@@ -259,6 +259,12 @@ impl TaikoPerformanceAttributes {
pub fn pp(&self) -> f64 {
self.pp
}
/// Return the maximum combo of the map.
#[inline]
pub fn max_combo(&self) -> usize {
self.attributes.max_combo
}
}
impl From<TaikoPerformanceAttributes> for TaikoDifficultyAttributes {