clamp clock rate

This commit is contained in:
MaxOhn
2023-02-09 06:25:26 +01:00
parent 1b5399070e
commit 7bac0c7215
9 changed files with 27 additions and 8 deletions
+3
View File
@@ -3,6 +3,9 @@
- __Additions:__ - __Additions:__
- Added the method `{TaikoPP/ManiaPP}::is_convert` which **needs** to be used if the map was manually converted beforehand - Added the method `{TaikoPP/ManiaPP}::is_convert` which **needs** to be used if the map was manually converted beforehand
- __Adjustments:__
- Specified clock rates can no longer go below 0.001 to prevent crashing due to memory hogging.
- __Fixes:__ - __Fixes:__
- The `Beatmap::bpm` method now works properly by considering the most common beat length instead of just the first one - The `Beatmap::bpm` method now works properly by considering the most common beat length instead of just the first one
+3 -1
View File
@@ -84,9 +84,11 @@ impl<'map> CatchStars<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -152,9 +152,11 @@ impl<'map> CatchPP<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -89,9 +89,11 @@ impl<'map> ManiaStars<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -120,9 +120,11 @@ impl<'map> ManiaPP<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -102,9 +102,11 @@ impl<'map> OsuStars<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -172,9 +172,11 @@ impl<'map> OsuPP<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -96,9 +96,11 @@ impl<'map> TaikoStars<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }
+3 -1
View File
@@ -162,9 +162,11 @@ impl<'map> TaikoPP<'map> {
/// Adjust the clock rate used in the calculation. /// Adjust the clock rate used in the calculation.
/// If none is specified, it will take the clock rate based on the mods /// If none is specified, it will take the clock rate based on the mods
/// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise. /// i.e. 1.5 for DT, 0.75 for HT and 1.0 otherwise.
///
/// The value cannot go below 0.001.
#[inline] #[inline]
pub fn clock_rate(mut self, clock_rate: f64) -> Self { pub fn clock_rate(mut self, clock_rate: f64) -> Self {
self.clock_rate = Some(clock_rate); self.clock_rate = Some(clock_rate.max(0.001));
self self
} }