diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-13 07:29:30 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2008-03-13 07:29:30 +0000 |
commit | fe474eb4fae9d89e3797d0ceaae6613798ce491f (patch) | |
tree | 2a91b2f17636ae7b20eea06a28a89942f6f36d39 /src/net | |
parent | 3a275cc81fe9aa1cb6736cdf12211e13e93cf2cf (diff) | |
download | mana-client-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.gz mana-client-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.bz2 mana-client-fe474eb4fae9d89e3797d0ceaae6613798ce491f.tar.xz mana-client-fe474eb4fae9d89e3797d0ceaae6613798ce491f.zip |
Synchronized pathfinding algorithmns with those used by the server to avoid asynchronisation.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/beinghandler.cpp | 10 | ||||
-rw-r--r-- | src/net/playerhandler.cpp | 3 |
2 files changed, 4 insertions, 9 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 05795cb1..f31ee48b 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -496,8 +496,7 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg) return; } - being->mX = px; - being->mY = py; + being->setPositionInPixels(px, py); being->setDestination(px, py); being->setAction(action); } @@ -544,11 +543,10 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg) { being->setWalkSpeed(speed * 10); } - if (abs(being->mX - sx) + abs(being->mY - sy) > 4 * 32) + if (abs(being->getPixelX() - sx) + abs(being->getPixelY() - sy) > 4 * 32) { // Too large a desynchronization. - being->mX = sx; - being->mY = sy; + being->setPositionInPixels(sx, sy); being->setDestination(dx, dy); } else if (!(flags & MOVING_POSITION)) @@ -582,8 +580,6 @@ void BeingHandler::handleBeingAttackMessage(MessageIn &msg) case DIRECTION_RIGHT: being->setDirection(Being::RIGHT); break; } - logger->log("Attacktype: %d", attackType); - being->setAction(Being::ATTACK, attackType); } diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index 3c06d2f5..b908eae5 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -301,6 +301,5 @@ PlayerHandler::handleMapChangeMessage(MessageIn &msg) current_npc = 0; player_node->setAction(Being::STAND); - player_node->mX = x; - player_node->mY = y; + player_node->setPositionInPixels(x, y); } |