wesnoth-cvs-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-cvs-commits] wesnoth/src preferences.hpp preferences.cpp


From: Jon Daniel
Subject: [Wesnoth-cvs-commits] wesnoth/src preferences.hpp preferences.cpp
Date: Sun, 31 Jul 2005 15:40:40 -0400

CVSROOT:        /cvsroot/wesnoth
Module name:    wesnoth
Branch:         
Changes by:     Jon Daniel <address@hidden>     05/07/31 19:40:40

Modified files:
        src            : preferences.hpp preferences.cpp 

Log message:
        make set_sound and set_music return bool so we can uncheck the button 
if it fails with no sound card.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.hpp.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/wesnoth/wesnoth/src/preferences.cpp.diff?tr1=1.164&tr2=1.165&r1=text&r2=text

Patches:
Index: wesnoth/src/preferences.cpp
diff -u wesnoth/src/preferences.cpp:1.164 wesnoth/src/preferences.cpp:1.165
--- wesnoth/src/preferences.cpp:1.164   Sun Jul 31 19:26:15 2005
+++ wesnoth/src/preferences.cpp Sun Jul 31 19:40:39 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.cpp,v 1.164 2005/07/31 19:26:15 j_daniel Exp $ */
+/* $Id: preferences.cpp,v 1.165 2005/07/31 19:40:39 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -452,12 +452,14 @@
        return prefs["sound"] != "no";
 }
 
-void set_sound(bool ison) {
+bool set_sound(bool ison) {
        if(!sound() && ison) {
                prefs["sound"] = "yes";
                if(!music()) {
-                       if(!sound::init_sound())
+                       if(!sound::init_sound()) {
                                prefs["sound"] = "no";
+                               return false;
+                       }
                }
        } else if(sound() && !ison) {
                prefs["sound"] = "no";
@@ -465,19 +467,21 @@
                if(!music())
                        sound::close_sound();
        }
-       return;
+       return true;
 }
 
 bool music() {
        return prefs["music"] != "no";
 }
 
-void set_music(bool ison) {
+bool set_music(bool ison) {
        if(!music() && ison) {
                prefs["music"] = "yes";
                if(!sound()) {
-                       if(!sound::init_sound())
+                       if(!sound::init_sound()) {
                                prefs["music"] = "no";
+                               return false;
+                       }
                }
                else
                        sound::play_music("");
@@ -488,7 +492,7 @@
                else
                        sound::stop_music();
        }
-       return;
+       return true;
 }
 
 bool turn_dialog()
@@ -1088,12 +1092,16 @@
                gamma_label_.hide(hide_gamma);
        }
 
-       if (sound_button_.pressed())
-               set_sound(sound_button_.checked());
+       if (sound_button_.pressed()) {
+               if(!set_sound(sound_button_.checked()))
+                       sound_button_.set_check(false);
+       }
        set_sound_volume(sound_slider_.value());
 
-       if (music_button_.pressed())
-               set_music(music_button_.checked());
+       if (music_button_.pressed()) {
+               if(!set_music(music_button_.checked()))
+                       music_button_.set_check(false);
+       }
        set_music_volume(music_slider_.value());
 
        if (flip_time_button_.pressed())
Index: wesnoth/src/preferences.hpp
diff -u wesnoth/src/preferences.hpp:1.59 wesnoth/src/preferences.hpp:1.60
--- wesnoth/src/preferences.hpp:1.59    Sun Jul 31 18:56:58 2005
+++ wesnoth/src/preferences.hpp Sun Jul 31 19:40:39 2005
@@ -1,4 +1,4 @@
-/* $Id: preferences.hpp,v 1.59 2005/07/31 18:56:58 j_daniel Exp $ */
+/* $Id: preferences.hpp,v 1.60 2005/07/31 19:40:39 j_daniel Exp $ */
 /*
    Copyright (C) 2003 by David White <address@hidden>
    Part of the Battle for Wesnoth Project http://www.wesnoth.org/
@@ -56,13 +56,13 @@
        void set_language(const std::string& s);
 
        bool sound();
-       void set_sound(bool ison);
+       bool set_sound(bool ison);
 
        int sound_volume();
        void set_sound_volume(int vol);
 
        bool music();
-       void set_music(bool ison);
+       bool set_music(bool ison);
 
        int music_volume();
        void set_music_volume(int vol);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]