From 5980dba7ace73e6587b9966bc2076ad2b2eaa5f0 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 27 Aug 2006 08:58:42 +0000 Subject: Send movements. --- src/net/beinghandler.cpp | 15 ++++++++++++--- src/net/protocol.h | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/net') 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 -- cgit v1.2.3-70-g09d2