fruits: fix handling passed_objects

This commit is contained in:
MaxOhn
2021-02-03 11:37:18 +01:00
parent e43b824062
commit 6b5dea5c2a
+3 -3
View File
@@ -29,12 +29,12 @@ const LEGACY_LAST_TICK_OFFSET: f32 = 36.0;
/// In case of a partial play, e.g. a fail, one can specify the amount of passed objects. /// In case of a partial play, e.g. a fail, one can specify the amount of passed objects.
// Slider parsing based on https://github.com/osufx/catch-the-pp // Slider parsing based on https://github.com/osufx/catch-the-pp
pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> StarResult { pub fn stars(map: &Beatmap, mods: impl Mods, passed_objects: Option<usize>) -> StarResult {
let take = passed_objects.unwrap_or_else(|| map.hit_objects.len()); if map.hit_objects.len() < 2 {
if take < 2 {
return StarResult::Fruits(DifficultyAttributes::default()); return StarResult::Fruits(DifficultyAttributes::default());
} }
let take = passed_objects.unwrap_or_else(|| usize::MAX);
let attributes = map.attributes().mods(mods); let attributes = map.attributes().mods(mods);
let with_hr = mods.hr(); let with_hr = mods.hr();
let mut ticks = Vec::new(); // using the same buffer for all sliders let mut ticks = Vec::new(); // using the same buffer for all sliders