diff options
Diffstat (limited to 'src/being')
-rw-r--r-- | src/being/localplayer.cpp | 32 | ||||
-rw-r--r-- | src/being/localplayer.h | 2 |
2 files changed, 20 insertions, 14 deletions
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; |