diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-01-17 02:17:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-01-17 02:17:45 +0300 |
commit | 001f897d939e5541868d0acefd4d5f9b2bed7271 (patch) | |
tree | 4079f8098284938aa5da9f0486c3b63d135b27bb /src | |
parent | 286de530777fa72c2b2b743f629dbbb7a7f4c8a5 (diff) | |
download | plus-001f897d939e5541868d0acefd4d5f9b2bed7271.tar.gz plus-001f897d939e5541868d0acefd4d5f9b2bed7271.tar.bz2 plus-001f897d939e5541868d0acefd4d5f9b2bed7271.tar.xz plus-001f897d939e5541868d0acefd4d5f9b2bed7271.zip |
Dont interrupt music if need play again same music.
Diffstat (limited to 'src')
-rw-r--r-- | src/soundmanager.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 558e4e12c..b60e84ef3 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -232,11 +232,14 @@ static SDLMusic *loadMusic(const std::string &fileName) void SoundManager::playMusic(const std::string &fileName) { - mCurrentMusicFile = fileName; - if (!mInstalled || !mPlayMusic) return; + if (mCurrentMusicFile == fileName) + return; + + mCurrentMusicFile = fileName; + haltMusic(); if (!fileName.empty()) @@ -407,6 +410,7 @@ void SoundManager::haltMusic() mMusic->decRef(); mMusic = nullptr; } + mCurrentMusicFile.clear(); } void SoundManager::changeAudio() |