summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-02 19:55:05 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-02 19:55:05 +0300
commitf1f04f512d284d12bf2c59e212800d7c24de323e (patch)
tree3bd062864af609ddd5410f47f528e6b3868cdeb8
parenteda234f5e156d376541044b351fd2e1e766700a3 (diff)
downloadmv-f1f04f512d284d12bf2c59e212800d7c24de323e.tar.gz
mv-f1f04f512d284d12bf2c59e212800d7c24de323e.tar.bz2
mv-f1f04f512d284d12bf2c59e212800d7c24de323e.tar.xz
mv-f1f04f512d284d12bf2c59e212800d7c24de323e.zip
Fix background musis if it was enabled by quck enable action.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp32
-rw-r--r--src/being/localplayer.h2
3 files changed, 22 insertions, 14 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 876c04700..47b3503e1 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -607,6 +607,8 @@ impHandler0(changeGameModifier)
impHandler0(changeAudio)
{
soundManager.changeAudio();
+ if (player_node)
+ player_node->updateMusic();
return true;
}
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 28b08a558..52bf2d75d 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -3126,6 +3126,23 @@ void LocalPlayer::navigateClean()
tmpLayer->clean();
}
+void LocalPlayer::updateMusic()
+{
+ if (mMap)
+ {
+ std::string str = mMap->getObjectData(mX, mY, MapItemType::MUSIC);
+ if (str.empty())
+ str = mMap->getMusicFile();
+ if (str != soundManager.getCurrentMusicFile())
+ {
+ if (str.empty())
+ soundManager.fadeOutMusic();
+ else
+ soundManager.fadeOutAndPlayMusic(str);
+ }
+ }
+}
+
void LocalPlayer::updateCoords()
{
Being::updateCoords();
@@ -3141,20 +3158,7 @@ void LocalPlayer::updateCoords()
socialWindow->updatePortals();
if (viewport)
viewport->hideBeingPopup();
- if (mMap)
- {
- std::string str = mMap->getObjectData(mX, mY,
- MapItemType::MUSIC);
- if (str.empty())
- str = mMap->getMusicFile();
- if (str != soundManager.getCurrentMusicFile())
- {
- if (str.empty())
- soundManager.fadeOutMusic();
- else
- soundManager.fadeOutAndPlayMusic(str);
- }
- }
+ updateMusic();
}
if (mShowNavigePath)
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index d327ee19a..2eb236918 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -496,6 +496,8 @@ class LocalPlayer final : public Being,
const int oldVal1,
const int oldVal2) override final;
+ void updateMusic();
+
protected:
void updateCoords() override final;