summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-03 13:32:07 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-03 13:32:07 +0000
commit092bf185fc056338bcde2749a304e576edf342fd (patch)
tree7f5c6424998ba44f8732ec12d07f315297d8e49f /src/sound.cpp
parent100d02440e6715b7e02867b84fed759ed4258c73 (diff)
downloadmana-092bf185fc056338bcde2749a304e576edf342fd.tar.gz
mana-092bf185fc056338bcde2749a304e576edf342fd.tar.bz2
mana-092bf185fc056338bcde2749a304e576edf342fd.tar.xz
mana-092bf185fc056338bcde2749a304e576edf342fd.zip
Don't try to play empty strings as sounds, and don't return a SoundEffect
instance when Mix_Chunk loading failed.
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index 8b012176..1ef4c23d 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -191,15 +191,15 @@ void Sound::fadeOutMusic(int ms)
}
}
-void Sound::playSfx(const char *path)
+void Sound::playSfx(const std::string &path)
{
- if (!mInstalled) return;
+ if (!mInstalled || path.length() == 0) return;
ResourceManager *resman = ResourceManager::getInstance();
SoundEffect *sample = resman->getSoundEffect(path);
if (sample) {
+ logger->log("Sound::playSfx() Playing: %s", path.c_str());
sample->play(0, 120);
- logger->log("Sound::playSfx() Playing: %s", path);
}
}