dep: use f64 for clock rate

This commit is contained in:
MaxOhn
2024-11-09 21:19:53 +01:00
parent 0448980cd5
commit 9edad8a3d5
4 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -417,9 +417,9 @@ impl ModsDependentKind {
}
}
fn value(&self, mods: &GameMods, mods_fn: impl Fn(&GameMods) -> Option<f32>) -> f32 {
fn value(&self, mods: &GameMods, mods_fn: impl Fn(&GameMods) -> Option<f64>) -> f32 {
match self {
ModsDependentKind::Default(inner) => mods_fn(mods).unwrap_or(inner.value),
ModsDependentKind::Default(inner) => mods_fn(mods).map_or(inner.value, |n| n as f32),
ModsDependentKind::Custom(inner) => inner.value,
}
}
+2 -2
View File
@@ -61,7 +61,7 @@ impl GameMods {
///
/// In case of variable clock rates like for `WindUp`, this will return
/// `1.0`.
pub(crate) fn clock_rate(&self) -> f32 {
pub(crate) fn clock_rate(&self) -> f64 {
match self.inner {
GameModsInner::Lazer(ref mods) => mods.clock_rate().unwrap_or(1.0),
GameModsInner::Intermode(ref mods) => mods.legacy_clock_rate(),
@@ -105,7 +105,7 @@ macro_rules! impl_map_attr {
#[doc = "Check whether the mods specify a custom "]
#[doc = $s]
#[doc = "value."]
pub(crate) fn $fn(&self) -> Option<f32> {
pub(crate) fn $fn(&self) -> Option<f64> {
match self.inner {
GameModsInner::Lazer(ref mods) => mods.iter().find_map(|gamemod| match gamemod {
$( impl_map_attr!( @ $mode $field) => *$field, )*