diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-27 08:58:42 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-27 08:58:42 +0000 |
commit | 5980dba7ace73e6587b9966bc2076ad2b2eaa5f0 (patch) | |
tree | 10ccabf85e599f47e31849c6e7d5ca50015e441e /src/net | |
parent | 40339bebb026cd553aacbbff6f2fe1aa14816d5a (diff) | |
download | mana-client-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.gz mana-client-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.bz2 mana-client-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.xz mana-client-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.zip |
Send movements.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/beinghandler.cpp | 15 | ||||
-rw-r--r-- | src/net/protocol.h | 2 |
2 files changed, 13 insertions, 4 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 93f5f1a8..4ff92b63 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -421,8 +421,17 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) 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); + bool update = being != player_node; // the local player already knows where he wants to go + if (abs(being->mX - sx / 32) + abs(being->mY - sy / 32) > 4) + { + // crude handling of synchronization messages + being->mX = sx / 32; + being->mY = sy / 32; + update = true; + } + if (update) + { + being->setDestination(dx / 32, dy / 32); + } } } diff --git a/src/net/protocol.h b/src/net/protocol.h index 92405c77..be6e27cb 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -155,7 +155,7 @@ enum { GPMSG_BEING_ENTER = 0x0200, // B type, L being id // 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 + PGMSG_WALK = 0x0260, // W*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 |