diff options
Diffstat (limited to 'src/net/tmwa/playerhandler.cpp')
-rw-r--r-- | src/net/tmwa/playerhandler.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index df56176f0..b1fa64d25 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -25,6 +25,7 @@ #include "configuration.h" #include "client.h" #include "game.h" +#include "soundmanager.h" #include "net/net.h" @@ -34,6 +35,8 @@ #include "gui/windows/whoisonline.h" +#include "gui/viewport.h" + #include "debug.h" extern Net::PlayerHandler *playerHandler; @@ -58,6 +61,7 @@ PlayerHandler::PlayerHandler() : SMSG_PLAYER_ARROW_MESSAGE, SMSG_ONLINE_LIST, SMSG_MAP_MASK, + SMSG_MAP_MUSIC, 0 }; handledMessages = _messages; @@ -114,6 +118,10 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) processMapMask(msg); break; + case SMSG_MAP_MUSIC: + processMapMusic(msg); + break; + default: break; } @@ -310,4 +318,15 @@ void PlayerHandler::processMapMask(Net::MessageIn &msg) const map->setMask(mask); } +void PlayerHandler::processMapMusic(Net::MessageIn &msg) const +{ + const int size = msg.readInt16() - 5; + const std::string music = msg.readString(size); + soundManager.playMusic(music); + + Map *const map = viewport->getMap(); + if (map) + map->setMusicFile(music); +} + } // namespace TmwAthena |