summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoderic Morris <roderic@ccs.neu.edu>2008-10-26 17:03:04 +0000
committerRoderic Morris <roderic@ccs.neu.edu>2008-10-26 17:03:04 +0000
commitcd42f593aa6cc236e1a9142fae7a711fd9841e6d (patch)
tree0fd4e4ca3c65a52dd9bd1009b1f10179737a9cb4
parent3925d9c41709dece19fe60c0e4bb111247f1886e (diff)
downloadmana-cd42f593aa6cc236e1a9142fae7a711fd9841e6d.tar.gz
mana-cd42f593aa6cc236e1a9142fae7a711fd9841e6d.tar.bz2
mana-cd42f593aa6cc236e1a9142fae7a711fd9841e6d.tar.xz
mana-cd42f593aa6cc236e1a9142fae7a711fd9841e6d.zip
fixes for movement
-rw-r--r--ChangeLog6
-rw-r--r--src/being.h5
-rw-r--r--src/net/beinghandler.cpp15
3 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 52c3df51..28820846 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-10-26 Chuck Miller <shadowmil@gmail.com>
+
+ * src/net/beinghandler.cpp,src/localplayer.cpp,src/being.h: Played
+ around more with movement. I think later on all of movement will
+ need to be revised. But this should work for now.
+
2008-10-25 Roderic Morris <roderic@ccs.neu.edu>
* src/commandhandler.cpp: get rid of /admin commands (they're now
diff --git a/src/being.h b/src/being.h
index 567a0d98..a0475910 100644
--- a/src/being.h
+++ b/src/being.h
@@ -124,6 +124,11 @@ class Being : public Sprite
void setDestination(int x, int y);
/**
+ * Returns the destination for this being.
+ */
+ const Vector &getDestination() const { return mDest; }
+
+ /**
* Adjusts course to expected stat point.
*/
void adjustCourse(int, int);
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index 0873764e..4d25b7d1 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -228,8 +228,21 @@ void BeingHandler::handleBeingsMoveMessage(MessageIn &msg)
const float tilesPerSecond = 100.0f / speed;
being->setWalkSpeed((int) (tilesPerSecond * 32));
}
+
+ // Ignore messages from the server for the local player
+ if (being == player_node)
+ break;
+
+ // 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) < 2 * 32 &&
+ (dx != being->getDestination().x && dy != being->getDestination().y))
+ {
+ being->setDestination(being->getPixelX(),being->getPixelY());
+ break;
+ }
if (abs(being->getPixelX() - sx) +
- abs(being->getPixelY() - sy) > 4 * 32)
+ abs(being->getPixelY() - sy) > 10 * 32)
{
// Too large a desynchronization.
being->setPosition(sx, sy);