add BeatmapAttributesBuilder::mode method
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user