From 7c883da9183238a0f1d75e2e815bc5f689956f14 Mon Sep 17 00:00:00 2001 From: Stefan Dombrowski Date: Thu, 9 Sep 2010 22:11:47 +0200 Subject: Fixing sound effects The sound effects did not get played, because the path was wrong. Reviewed-by: Turmfalke --- src/sound.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/sound.cpp') diff --git a/src/sound.cpp b/src/sound.cpp index 241e25e4..d3542a48 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -239,8 +239,7 @@ void Sound::playSfx(const std::string &path) return; ResourceManager *resman = ResourceManager::getInstance(); - SoundEffect *sample = resman->getSoundEffect( - paths.getValue("sfx", "sfx/") + path); + SoundEffect *sample = resman->getSoundEffect(path); if (sample) { logger->log("Sound::playSfx() Playing: %s", path.c_str()); -- cgit v1.2.3-70-g09d2 From af176c1f344a78a352ecaa6f252054f5ac38ec73 Mon Sep 17 00:00:00 2001 From: Stefan Dombrowski Date: Mon, 13 Sep 2010 14:19:11 +0200 Subject: Avoid loading non-existing music and minimaps Reviewed-by: Thorbjorn --- src/game.cpp | 7 ++++++- src/gui/minimap.cpp | 3 ++- src/sound.cpp | 7 +------ 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src/sound.cpp') diff --git a/src/game.cpp b/src/game.cpp index 026b0017..8e856dc0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -958,7 +958,12 @@ void Game::changeMap(const std::string &mapPath) std::string oldMusic = mCurrentMap ? mCurrentMap->getMusicFile() : ""; std::string newMusic = newMap ? newMap->getMusicFile() : ""; if (newMusic != oldMusic) - sound.playMusic(newMusic); + { + if (newMusic.empty()) + sound.stopMusic(); + else + sound.playMusic(newMusic); + } delete mCurrentMap; mCurrentMap = newMap; diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 35844f64..8713d3f9 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -106,7 +106,8 @@ void Minimap::setMap(Map *map) if (minimapName.empty() && resman->exists(tempname)) minimapName = tempname; - mMapImage = resman->getImage(minimapName); + if (!minimapName.empty()) + mMapImage = resman->getImage(minimapName); } if (mMapImage) diff --git a/src/sound.cpp b/src/sound.cpp index d3542a48..fa39e49b 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -195,12 +195,7 @@ void Sound::stopMusic() logger->log("Sound::stopMusic()"); - if (mMusic) - { - Mix_HaltMusic(); - Mix_FreeMusic(mMusic); - mMusic = NULL; - } + haltMusic(); } void Sound::fadeInMusic(const std::string &path, int ms) -- cgit v1.2.3-70-g09d2