added is_convert method to TaikoPP and ManiaPP

This commit is contained in:
MaxOhn
2023-02-02 08:54:47 +01:00
parent 741aa7a8e3
commit 1b5399070e
5 changed files with 46 additions and 5 deletions
+2
View File
@@ -97,6 +97,8 @@ impl<'map> ManiaStars<'map> {
}
/// Specify whether the map is a convert i.e. an osu!standard map.
///
/// This only needs to be specified if the map was converted manually beforehand.
#[inline]
pub fn is_convert(mut self, is_convert: bool) -> Self {
self.is_convert = is_convert;
+19 -2
View File
@@ -42,6 +42,7 @@ use crate::{
#[allow(clippy::upper_case_acronyms)]
pub struct ManiaPP<'map> {
map: Cow<'map, Beatmap>,
is_convert: bool,
attributes: Option<ManiaDifficultyAttributes>,
mods: u32,
passed_objects: Option<usize>,
@@ -62,8 +63,11 @@ impl<'map> ManiaPP<'map> {
/// Create a new performance calculator for osu!mania maps.
#[inline]
pub fn new(map: &'map Beatmap) -> Self {
let map = map.convert_mode(GameMode::Mania);
Self {
map: map.convert_mode(GameMode::Mania),
is_convert: matches!(map, Cow::Owned(_)),
map,
attributes: None,
mods: 0,
passed_objects: None,
@@ -190,6 +194,16 @@ impl<'map> ManiaPP<'map> {
self
}
/// Specify whether the map is a convert i.e. an osu!standard map.
///
/// This only needs to be specified if the map was converted manually beforehand.
#[inline]
pub fn is_convert(mut self, is_convert: bool) -> Self {
self.is_convert = is_convert;
self
}
/// Provide parameters through an [`ManiaScoreState`].
#[inline]
pub fn state(mut self, state: ManiaScoreState) -> Self {
@@ -581,8 +595,11 @@ impl<'map> From<OsuPP<'map>> for ManiaPP<'map> {
hitresult_priority,
} = osu;
let map = map.convert_mode(GameMode::Mania);
Self {
map: map.convert_mode(GameMode::Mania),
is_convert: matches!(map, Cow::Owned(_)),
map,
attributes: None,
mods,
passed_objects,