summaryrefslogtreecommitdiff
path: root/src/net/tmwa/playerhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-09 17:59:14 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-09 17:59:14 +0300
commitdb1e60556c72b1b87ff2a384c556ccca724c46d6 (patch)
tree22a5f4e9c4f436ef8e746e0a2d688de80c1597a6 /src/net/tmwa/playerhandler.cpp
parentc2bb49be52a92deccec7428b6859242688fc8987 (diff)
parent1716861f0ee2f7a3714c5b44bb0f017c3d8d3b2c (diff)
downloadplus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.gz
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.bz2
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.tar.xz
plus-db1e60556c72b1b87ff2a384c556ccca724c46d6.zip
Merge branch 'master' into stable
Diffstat (limited to 'src/net/tmwa/playerhandler.cpp')
-rw-r--r--src/net/tmwa/playerhandler.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 0361e125d..164ecb8c2 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -23,7 +23,8 @@
#include "net/tmwa/playerhandler.h"
#include "configuration.h"
-#include "client.h"
+#include "game.h"
+#include "soundmanager.h"
#include "net/net.h"
@@ -33,9 +34,12 @@
#include "gui/windows/whoisonline.h"
+#include "gui/viewport.h"
+
#include "debug.h"
extern Net::PlayerHandler *playerHandler;
+extern int serverVersion;
namespace TmwAthena
{
@@ -56,6 +60,8 @@ PlayerHandler::PlayerHandler() :
SMSG_PLAYER_STAT_UPDATE_6,
SMSG_PLAYER_ARROW_MESSAGE,
SMSG_ONLINE_LIST,
+ SMSG_MAP_MASK,
+ SMSG_MAP_MUSIC,
0
};
handledMessages = _messages;
@@ -108,6 +114,14 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
processOnlineList(msg);
break;
+ case SMSG_MAP_MASK:
+ processMapMask(msg);
+ break;
+
+ case SMSG_MAP_MUSIC:
+ processMapMusic(msg);
+ break;
+
default:
break;
}
@@ -295,4 +309,24 @@ void PlayerHandler::updateStatus(const uint8_t status) const
outMsg.writeInt8(0);
}
+void PlayerHandler::processMapMask(Net::MessageIn &msg) const
+{
+ const int mask = msg.readInt32();
+ msg.readInt32(); // unused
+ Map *const map = Game::instance()->getCurrentMap();
+ if (map)
+ 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