bool set_sound(bool ison) { if(!sound_on() && ison) { preferences::set("sound", true); if(!music_on() && !turn_bell() && !UI_sound_on()) { if(!sound::init_sound()) { preferences::set("sound", false); return false; } } } else if(sound_on() && !ison) { preferences::set("sound", false); sound::stop_sound(); if(!music_on() && !turn_bell() && !UI_sound_on()) sound::close_sound(); } return true; }
bool set_UI_sound(bool ison) { if(!UI_sound_on() && ison) { preferences::set("UI_sound", "yes"); if(!music_on() && !sound_on() && !turn_bell()) { if(!sound::init_sound()) { preferences::set("UI_sound", "no"); return false; } } } else if(UI_sound_on() && !ison) { preferences::set("UI_sound", "no"); sound::stop_UI_sound(); if(!music_on() && !sound_on() && !turn_bell()) sound::close_sound(); } return true; }
bool set_music(bool ison) { if(!music_on() && ison) { preferences::set("music", true); if(!sound_on() && !turn_bell() && !UI_sound_on()) { if(!sound::init_sound()) { preferences::set("music", false); return false; } } else sound::play_music(); } else if(music_on() && !ison) { preferences::set("music", false); if(!sound_on() && !turn_bell() && !UI_sound_on()) sound::close_sound(); else sound::stop_music(); } return true; }