diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-30 22:02:02 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-30 22:10:17 +0300 |
commit | 4d2b3cae0ab00d1ef832f11d14bd299d6d5c2a6b (patch) | |
tree | 143a9b96bc0ad57ea90d466d70c5bc5749daf541 /src/net/tmwa/playerhandler.cpp | |
parent | bb5d5bfd20c09952cfb3b9881b90177b0c34aac7 (diff) | |
download | plus-4d2b3cae0ab00d1ef832f11d14bd299d6d5c2a6b.tar.gz plus-4d2b3cae0ab00d1ef832f11d14bd299d6d5c2a6b.tar.bz2 plus-4d2b3cae0ab00d1ef832f11d14bd299d6d5c2a6b.tar.xz plus-4d2b3cae0ab00d1ef832f11d14bd299d6d5c2a6b.zip |
add support for temporary replace background music on given map by server.
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 |