diff options
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r-- | src/net/beinghandler.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index c6db8e33..08d47f01 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -57,6 +57,7 @@ BeingHandler::BeingHandler() GPMSG_BEING_ENTER, GPMSG_BEING_LEAVE, GPMSG_BEINGS_MOVE, + GPMSG_BEINGS_DAMAGE, 0 }; handledMessages = _messages; @@ -89,6 +90,9 @@ void BeingHandler::handleMessage(MessageIn &msg) case GPMSG_BEING_ATTACK: handleBeingAttackMessage(msg); break; + case GPMSG_BEINGS_DAMAGE: + handleBeingsDamageMessage(msg); + break; /* case SMSG_BEING_VISIBLE: @@ -498,3 +502,16 @@ void BeingHandler::handleBeingAttackMessage(MessageIn &msg) being->setAction(Being::ATTACK); } + +void BeingHandler::handleBeingsDamageMessage(MessageIn &msg) +{ + while (msg.getUnreadLength()) + { + Being *being = beingManager->findBeing(msg.readShort()); + int damage = msg.readShort(); + if (being) + { + being->setDamage(damage, 0); + } + } +} |