clamp given accuracy

This commit is contained in:
MaxOhn
2024-03-13 16:42:41 +01:00
parent 3f43a01727
commit f23e2bbeb9
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -266,7 +266,7 @@ impl<'map> CatchPerformance<'map> {
/// Specify the accuracy of a play between `0.0` and `100.0`.
/// This will be used to generate matching hitresults.
pub fn accuracy(mut self, acc: f64) -> Self {
self.acc = Some(acc / 100.0);
self.acc = Some(acc.clamp(0.0, 100.0) / 100.0);
self
}
+1 -1
View File
@@ -168,7 +168,7 @@ impl<'map> ManiaPerformance<'map> {
/// Specify the accuracy of a play between `0.0` and `100.0`.
/// This will be used to generate matching hitresults.
pub fn accuracy(mut self, acc: f64) -> Self {
self.acc = Some(acc / 100.0);
self.acc = Some(acc.clamp(0.0, 100.0) / 100.0);
self
}
+1 -1
View File
@@ -309,7 +309,7 @@ impl<'map> OsuPerformance<'map> {
/// Specify the accuracy of a play between `0.0` and `100.0`.
/// This will be used to generate matching hitresults.
pub fn accuracy(mut self, acc: f64) -> Self {
self.acc = Some(acc / 100.0);
self.acc = Some(acc.clamp(0.0, 100.0) / 100.0);
self
}
+1 -1
View File
@@ -135,7 +135,7 @@ impl<'map> TaikoPerformance<'map> {
/// Specify the accuracy of a play between `0.0` and `100.0`.
/// This will be used to generate matching hitresults.
pub fn accuracy(mut self, acc: f64) -> Self {
self.acc = Some(acc / 100.0);
self.acc = Some(acc.clamp(0.0, 100.0) / 100.0);
self
}