convert map internally for tko & mna

This commit is contained in:
MaxOhn
2022-10-26 22:02:17 +02:00
parent de400b29cf
commit b6ec17fd12
8 changed files with 17 additions and 9 deletions
+1
View File
@@ -1,6 +1,7 @@
/target /target
Cargo.lock Cargo.lock
output* output*
/tests/custom.rs
/pp-gen/.env /pp-gen/.env
/pp-gen/target /pp-gen/target
+2 -1
View File
@@ -1,6 +1,7 @@
## Upcoming ## Upcoming
Nothing as of now - __Adjustments:__
- When passing an osu!std map to `TaikoPP` or `ManiaPP`, it now automatically converts the map internally. For osu!catch it was already happening trivially.
# v0.9.0 (2022-10-24) # v0.9.0 (2022-10-24)
+1 -1
View File
@@ -130,7 +130,7 @@ impl Beatmap {
/// - Since hitsounds are irrelevant for difficulty and performance calculations /// - Since hitsounds are irrelevant for difficulty and performance calculations
/// in osu!mania, the resulting map of a conversion to mania will not contain hitsounds. /// in osu!mania, the resulting map of a conversion to mania will not contain hitsounds.
/// - To avoid having to clone the map for osu!catch conversions, the field `Beatmap::mode` /// - To avoid having to clone the map for osu!catch conversions, the field `Beatmap::mode`
/// will not be adjusted in a ctb-converted map. /// will not be adjusted in a osu!catch-converted map.
#[inline] #[inline]
pub fn convert_mode(&self, mode: GameMode) -> Cow<'_, Self> { pub fn convert_mode(&self, mode: GameMode) -> Cow<'_, Self> {
if mode == self.mode { if mode == self.mode {
+5 -2
View File
@@ -53,12 +53,15 @@ impl<'map> ManiaStars<'map> {
/// Create a new difficulty calculator for osu!mania maps. /// Create a new difficulty calculator for osu!mania maps.
#[inline] #[inline]
pub fn new(map: &'map Beatmap) -> Self { pub fn new(map: &'map Beatmap) -> Self {
let map = map.convert_mode(GameMode::Mania);
let is_convert = matches!(map, Cow::Owned(_));
Self { Self {
map: Cow::Borrowed(map), map,
mods: 0, mods: 0,
passed_objects: None, passed_objects: None,
clock_rate: None, clock_rate: None,
is_convert: false, is_convert,
} }
} }
+1 -1
View File
@@ -63,7 +63,7 @@ impl<'map> ManiaPP<'map> {
#[inline] #[inline]
pub fn new(map: &'map Beatmap) -> Self { pub fn new(map: &'map Beatmap) -> Self {
Self { Self {
map: Cow::Borrowed(map), map: map.convert_mode(GameMode::Mania),
attributes: None, attributes: None,
mods: 0, mods: 0,
passed_objects: None, passed_objects: None,
+1 -1
View File
@@ -516,7 +516,7 @@ pub struct OsuDifficultyAttributes {
/// The overall difficulty /// The overall difficulty
pub od: f64, pub od: f64,
/// The health drain rate. /// The health drain rate.
pub hp: f64, pub hp: f64, // TODO: remove as it is not used for performance calculation
/// The amount of circles. /// The amount of circles.
pub n_circles: usize, pub n_circles: usize,
/// The amount of sliders. /// The amount of sliders.
+5 -2
View File
@@ -55,12 +55,15 @@ impl<'map> TaikoStars<'map> {
/// Create a new difficulty calculator for osu!taiko maps. /// Create a new difficulty calculator for osu!taiko maps.
#[inline] #[inline]
pub fn new(map: &'map Beatmap) -> Self { pub fn new(map: &'map Beatmap) -> Self {
let map = map.convert_mode(GameMode::Taiko);
let is_convert = matches!(map, Cow::Owned(_));
Self { Self {
map: Cow::Borrowed(map), map,
mods: 0, mods: 0,
passed_objects: None, passed_objects: None,
clock_rate: None, clock_rate: None,
is_convert: false, is_convert,
} }
} }
+1 -1
View File
@@ -56,7 +56,7 @@ impl<'map> TaikoPP<'map> {
#[inline] #[inline]
pub fn new(map: &'map Beatmap) -> Self { pub fn new(map: &'map Beatmap) -> Self {
Self { Self {
map: Cow::Borrowed(map), map: map.convert_mode(GameMode::Taiko),
attributes: None, attributes: None,
mods: 0, mods: 0,
combo: None, combo: None,