diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-26 19:26:41 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-26 19:26:41 +0000 |
commit | fd279ae77295a6babedd31202078862eabcada9f (patch) | |
tree | d3ebc7572ac92990375a461cbca198bf9fdde3cc | |
parent | 07b6070c25faedd78c2e26825bd700dc294f00cf (diff) | |
download | mana-fd279ae77295a6babedd31202078862eabcada9f.tar.gz mana-fd279ae77295a6babedd31202078862eabcada9f.tar.bz2 mana-fd279ae77295a6babedd31202078862eabcada9f.tar.xz mana-fd279ae77295a6babedd31202078862eabcada9f.zip |
Handle "beings move" messages.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/net/beinghandler.cpp | 24 | ||||
-rw-r--r-- | src/net/beinghandler.h | 4 | ||||
-rw-r--r-- | src/net/protocol.h | 1 |
4 files changed, 29 insertions, 2 deletions
@@ -24,6 +24,8 @@ src/net/charserverhandler.cpp, src/net/messagehandler.cpp, src/net/network.cpp, src/localplayer.h, src/game.h: Made the Network class a purely static interface, as there is only one instance. + * src/net/beinghandler.cpp, src/net/beinghandler.h, src/net/protocol.h: + Added support for "beings move" messages. 2006-08-21 Eugenio Favalli <elvenprogrammer@gmail.com> diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index c85e8893..93f5f1a8 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -54,6 +54,7 @@ BeingHandler::BeingHandler() //SMSG_PLAYER_MOVE, //0x0119, GPMSG_BEING_ENTER, + GPMSG_BEINGS_MOVE, 0 }; handledMessages = _messages; @@ -61,11 +62,13 @@ BeingHandler::BeingHandler() void BeingHandler::handleMessage(MessageIn &msg) { + /* Uint32 id; Uint16 job, speed; Sint16 param1; Sint8 type; Being *srcBeing, *dstBeing; + */ switch (msg.getId()) { @@ -73,6 +76,11 @@ void BeingHandler::handleMessage(MessageIn &msg) handleBeingEnterMessage(msg); break; + case GPMSG_BEINGS_MOVE: + handleBeingsMoveMessage(msg); + break; + + /* case SMSG_BEING_VISIBLE: case SMSG_BEING_MOVE: // Information about a being in range @@ -377,6 +385,7 @@ void BeingHandler::handleMessage(MessageIn &msg) msg.readShort(), msg.readShort(), msg.readShort(), msg.readByte()); break; + */ } } @@ -402,3 +411,18 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) being->setHairColor(msg.readByte()); being->setSex(msg.readByte()); } + +void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) +{ + for (int nb = (msg.getLength() - 2) / (4 + 4 * 2); nb > 0; --nb) + { + Uint32 id = msg.readLong(); + Being *being = beingManager->findBeing(id); + if (!being) continue; + int sx = msg.readShort(), sy = msg.readShort(), + dx = msg.readShort(), dy = msg.readShort(); + being->mX = sx / 32; + being->mY = sy / 32; + being->setDestination(dx / 32, dy / 32); + } +} diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 2dd81e1a..0b0d10b9 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -34,8 +34,8 @@ class BeingHandler : public MessageHandler void handleMessage(MessageIn &msg); private: - void - handleBeingEnterMessage(MessageIn &msg); + void handleBeingEnterMessage(MessageIn &msg); + void handleBeingsMoveMessage(MessageIn &msg); }; #endif diff --git a/src/net/protocol.h b/src/net/protocol.h index 33d72c96..92405c77 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -156,6 +156,7 @@ enum { // player: S name, B hair style, B hair color, B gender GPMSG_BEING_LEAVE = 0x0201, // B type, L being id PGMSG_WALK = 0x0260, // L*2 destination + GPMSG_BEINGS_MOVE = 0x0280, // { L being id, W*2 position, W*2 destination }* PGMSG_SAY = 0x02A0, // S text GPMSG_SAY = 0x02A1, // L being id, S text PGMSG_USE_ITEM = 0x0300, // L item id |