summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-14 02:47:42 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-14 02:47:42 +0000
commit62de779017018a6e8f89fed9e0c930fc4904f5d2 (patch)
tree2a5736be211c11104c52a692a712c9b4a3683df8 /src/sound.cpp
parent55707a5da749734813d03019b7f1306ddd44e872 (diff)
downloadmana-client-62de779017018a6e8f89fed9e0c930fc4904f5d2.tar.gz
mana-client-62de779017018a6e8f89fed9e0c930fc4904f5d2.tar.bz2
mana-client-62de779017018a6e8f89fed9e0c930fc4904f5d2.tar.xz
mana-client-62de779017018a6e8f89fed9e0c930fc4904f5d2.zip
Fixed pixel alignment error in playerset that was just introduced, and fixed
initialization and cleanup in sound engine (solved crash at least in case of no sound).
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 98fef632..f76b6910 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -25,6 +25,18 @@
#include "log.h"
#include "main.h"
+Sound::Sound():
+ installed(false),
+ items(-1)
+{
+}
+
+Sound::~Sound()
+{
+ stopMusic();
+ close();
+}
+
void Sound::init()
{
// Don't initialize sound engine twice
@@ -52,7 +64,6 @@ void Sound::init()
info();
music = NULL;
- items = -1;
installed = true;
}
@@ -219,7 +230,7 @@ void Sound::playSfx(const char *path)
void Sound::clearCache()
{
- for (SOUND_ID i = 0; i == items; i++) {
+ for (SOUND_ID i = 0; i <= items; i++) {
soundPool[i]->unload();
delete soundPool[i];
soundPool[i] = NULL;