summaryrefslogtreecommitdiff
path: root/src/net/tmwserv/beinghandler.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-08-01 00:13:22 -0400
committerChuck Miller <shadowmil@gmail.com>2009-08-01 02:09:23 -0400
commitede286e65f1ccbf4ddfddba7be66467272440a13 (patch)
tree6c4bbe23e2e68a1bf1edc14beed4b064a8967d88 /src/net/tmwserv/beinghandler.cpp
parent299f987469192b7c77b4b724875b481a8fa83ced (diff)
downloadMana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.gz
Mana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.bz2
Mana-ede286e65f1ccbf4ddfddba7be66467272440a13.tar.xz
Mana-ede286e65f1ccbf4ddfddba7be66467272440a13.zip
Simplifies movement to only move to the current pos
Diffstat (limited to 'src/net/tmwserv/beinghandler.cpp')
-rw-r--r--src/net/tmwserv/beinghandler.cpp46
1 files changed, 4 insertions, 42 deletions
diff --git a/src/net/tmwserv/beinghandler.cpp b/src/net/tmwserv/beinghandler.cpp
index 2eed1dc3..93f76ce7 100644
--- a/src/net/tmwserv/beinghandler.cpp
+++ b/src/net/tmwserv/beinghandler.cpp
@@ -187,28 +187,14 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg)
Being *being = beingManager->findBeing(id);
int sx = 0;
int sy = 0;
- int dx = 0;
- int dy = 0;
int speed = 0;
if (flags & MOVING_POSITION)
{
- Uint16 sx2, sy2;
- msg.readCoordinates(sx2, sy2);
- sx = sx2 * 32 + 16;
- sy = sy2 * 32 + 16;
+ sx = msg.readInt16();
+ sy = msg.readInt16();
speed = msg.readInt8();
}
- if (flags & MOVING_DESTINATION)
- {
- dx = msg.readInt16();
- dy = msg.readInt16();
- if (!(flags & MOVING_POSITION))
- {
- sx = dx;
- sy = dy;
- }
- }
if (!being || !(flags & (MOVING_POSITION | MOVING_DESTINATION)))
{
continue;
@@ -228,33 +214,9 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg)
if (being == player_node)
continue;
- // If being is a player, and he only moves a little, its ok to be a little out of sync
- if (being->getType() == Being::PLAYER && abs(being->getPixelX() - dx) +
- abs(being->getPixelY() - dy) < 16 &&
- (dx != being->getDestination().x &&
- dy != being->getDestination().y))
- {
- being->setDestination(being->getPixelX(),being->getPixelY());
- continue;
- }
- if (abs(being->getPixelX() - sx) +
- abs(being->getPixelY() - sy) > 10 * 32)
- {
- // Too large a desynchronization.
- being->setPosition(sx, sy);
- being->setDestination(dx, dy);
- }
- else if (!(flags & MOVING_POSITION))
- {
- being->setDestination(dx, dy);
- }
- else if (!(flags & MOVING_DESTINATION))
- {
- being->adjustCourse(sx, sy);
- }
- else
+ if (flags & MOVING_POSITION)
{
- being->setDestination(sx, sy, dx, dy);
+ being->setDestination(sx, sy);
}
}
}