summaryrefslogtreecommitdiff
path: root/src/gui/setup_audio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/setup_audio.cpp')
-rw-r--r--src/gui/setup_audio.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp
index c0c2b9e4..5e13574e 100644
--- a/src/gui/setup_audio.cpp
+++ b/src/gui/setup_audio.cpp
@@ -91,8 +91,11 @@ void Setup_Audio::apply()
new OkDialog("Sound Engine", err);
logger->log("Warning: %s", err);
}
- Map *currentMap = engine->getCurrentMap();
- sound.playMusic(currentMap->getProperty("music"), -1);
+
+ if (engine) {
+ Map *currentMap = engine->getCurrentMap();
+ sound.playMusic(currentMap->getProperty("music"), -1);
+ }
}
else
{
@@ -101,8 +104,8 @@ void Setup_Audio::apply()
}
mSoundEnabled = config.getValue("sound", 0);
- mSfxVolume = (int)config.getValue("sfxVolume", 100);
- mMusicVolume = (int)config.getValue("musicVolume", 60);
+ mSfxVolume = (int) config.getValue("sfxVolume", 100);
+ mMusicVolume = (int) config.getValue("musicVolume", 60);
}
void Setup_Audio::cancel()
@@ -115,7 +118,7 @@ void Setup_Audio::cancel()
sound.setMusicVolume(mMusicVolume);
mMusicSlider->setValue(mMusicVolume);
- config.setValue("sound", mSoundEnabled ? true : false);
+ config.setValue("sound", mSoundEnabled ? 1 : 0);
config.setValue("sfxVolume", mSfxVolume);
config.setValue("musicVolume", mMusicVolume);
}
@@ -124,12 +127,12 @@ void Setup_Audio::action(const gcn::ActionEvent &event)
{
if (event.getId() == "sfx")
{
- config.setValue("sfxVolume", (int)mSfxSlider->getValue());
- sound.setSfxVolume((int)mSfxSlider->getValue());
+ config.setValue("sfxVolume", (int) mSfxSlider->getValue());
+ sound.setSfxVolume((int) mSfxSlider->getValue());
}
else if (event.getId() == "music")
{
- config.setValue("musicVolume", (int)mMusicSlider->getValue());
+ config.setValue("musicVolume", (int) mMusicSlider->getValue());
sound.setMusicVolume((int)mMusicSlider->getValue());
}
}