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/beinghandler.cpp | |
parent | 40339bebb026cd553aacbbff6f2fe1aa14816d5a (diff) | |
download | mana-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.gz mana-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.bz2 mana-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.tar.xz mana-5980dba7ace73e6587b9966bc2076ad2b2eaa5f0.zip |
Send movements.
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r-- | src/net/beinghandler.cpp | 15 |
1 files changed, 12 insertions, 3 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); + } } } |