add BeatmapAttributesBuilder::mode method

This commit is contained in:
MaxOhn
2024-02-29 22:51:25 +01:00
parent 4731da64dc
commit 760038d049
+14 -3
View File
@@ -53,8 +53,8 @@ impl BeatmapAttributesBuilder {
const TAIKO_MAX: f64 = 20.0;
/// Create a new [`BeatmapAttributesBuilder`].
pub fn new(map: &Beatmap) -> Self {
map.into()
pub const fn new(map: &Beatmap) -> Self {
Self::new_internal(map, false)
}
const fn new_internal(map: &Beatmap, is_convert: bool) -> Self {
@@ -112,6 +112,17 @@ impl BeatmapAttributesBuilder {
self
}
/// Specify a [`GameMode`] and whether it's a converted map.
///
/// This should only be used if the [`BeatmapAttributesBuilder`] was
/// **not** created through a [`Beatmap`] or [`Converted`].
pub fn mode(&mut self, mode: GameMode, is_convert: bool) -> &mut Self {
self.mode = mode;
self.is_convert = is_convert;
self
}
/// Calculate the AR and OD hit windows.
pub fn hit_windows(&self) -> HitWindows {
let mods = self.mods;
@@ -226,7 +237,7 @@ impl BeatmapAttributesBuilder {
impl From<&Beatmap> for BeatmapAttributesBuilder {
fn from(map: &Beatmap) -> Self {
Self::new_internal(map, false)
Self::new(map)
}
}