diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/net/beinghandler.cpp | 17 | ||||
-rw-r--r-- | src/net/beinghandler.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index ac2801c2..59a4fa9a 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_BEING_LEAVE, GPMSG_BEINGS_MOVE, 0 }; @@ -76,6 +77,10 @@ void BeingHandler::handleMessage(MessageIn &msg) handleBeingEnterMessage(msg); break; + case GPMSG_BEING_LEAVE: + handleBeingLeaveMessage(msg); + break; + case GPMSG_BEINGS_MOVE: handleBeingsMoveMessage(msg); break; @@ -412,6 +417,18 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) being->setSex(msg.readByte()); } +void BeingHandler::handleBeingLeaveMessage(MessageIn &msg) +{ + msg.readByte(); // type, assume player for now, TODO + Being *being = beingManager->findBeing(msg.readLong()); + if (!being) return; + if (being == player_node->getTarget()) + { + player_node->stopAttack(); + } + beingManager->destroyBeing(being); +} + void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) { for (int nb = (msg.getLength() - 2) / (4 + 4 * 2); nb > 0; --nb) diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 0b0d10b9..59539ffe 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -35,6 +35,7 @@ class BeingHandler : public MessageHandler private: void handleBeingEnterMessage(MessageIn &msg); + void handleBeingLeaveMessage(MessageIn &msg); void handleBeingsMoveMessage(MessageIn &msg); }; |