summaryrefslogtreecommitdiff
path: root/src/net/beinghandler.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-25 20:22:41 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-25 20:22:41 +0000
commit88b3f92061c703fdf6cf0f970684fb77de6d8795 (patch)
tree881b72c8d80857787938b128ab5449109953c248 /src/net/beinghandler.cpp
parent25db7453b0027863ae4b966a91fb3653d73d324c (diff)
downloadmana-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.gz
mana-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.bz2
mana-88b3f92061c703fdf6cf0f970684fb77de6d8795.tar.xz
mana-88b3f92061c703fdf6cf0f970684fb77de6d8795.zip
Added being speed to protocol.
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r--src/net/beinghandler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index bce2c3b8..44b1a7af 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -487,7 +487,6 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg)
int monsterId = msg.readShort();
Being *being;
being = beingManager->createBeing(id, monsterId);
- being->setWalkSpeed(150); // TODO
being->mX = px;
being->mY = py;
being->setDestination(px, py);
@@ -519,16 +518,17 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg)
{
while (msg.getUnreadLength())
{
- Uint16 id = msg.readShort();
- Uint8 flags = msg.readByte();
+ int id = msg.readShort();
+ int flags = msg.readByte();
Being *being = beingManager->findBeing(id);
- int sx = 0, sy = 0, dx = 0, dy = 0;
+ int sx = 0, sy = 0, dx = 0, dy = 0, speed = 0;
if (flags & MOVING_POSITION)
{
Uint16 sx2, sy2;
msg.readCoordinates(sx2, sy2);
sx = sx2 * 32 + 16;
sy = sy2 * 32 + 16;
+ speed = msg.readByte();
}
if (flags & MOVING_DESTINATION)
{
@@ -544,6 +544,10 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg)
{
continue;
}
+ if (speed)
+ {
+ being->setWalkSpeed(speed * 10);
+ }
if (abs(being->mX - sx) + abs(being->mY - sy) > 4 * 32)
{
// Too large a desynchronization.