fix factory reset (light amp and flashlight power)

This commit is contained in:
yuni 2024-11-25 23:49:57 +01:00
parent fa504097bb
commit 06f23bf7ac
2 changed files with 9 additions and 1 deletions

View file

@ -803,7 +803,7 @@ pub fn handle_input(
MenuAction::ResetSettings => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::PowerDown));
*settings = Settings::default();
*prefs = Preferences::default();
prefs.reset();
// prefs.save(); // prefs are saved by the GameEvents already
ew_game.send(GameEvent::SetShadows(Turn::Unchanged));
ew_game.send(GameEvent::SetFullscreen(Turn::Unchanged));

View file

@ -543,6 +543,14 @@ impl Preferences {
}
}
}
pub fn reset(&mut self) {
*self = Preferences::default();
// why is this necessary?...
self.light_amp = Preferences::default_light_amp();
self.flashlight_power = Preferences::default_flashlight_power();
}
}
fn file_is_readable(file_path: &str) -> bool {