summaryrefslogtreecommitdiff
path: root/src/being
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-07 20:01:53 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-07 20:01:53 +0300
commit387d06f36504e65a9ce82984944fc844181c80fe (patch)
treedd1a9e1e49831e47d2ff27dd53a331296b3de82f /src/being
parent1708cce0de3c195b0ecaa8a5f8383712dc0d4c13 (diff)
downloadmanaplus-387d06f36504e65a9ce82984944fc844181c80fe.tar.gz
manaplus-387d06f36504e65a9ce82984944fc844181c80fe.tar.bz2
manaplus-387d06f36504e65a9ce82984944fc844181c80fe.tar.xz
manaplus-387d06f36504e65a9ce82984944fc844181c80fe.zip
Change desync detection to simpler way.
Also use "sync move" option to enable/disable short/long range desync fix.
Diffstat (limited to 'src/being')
-rw-r--r--src/being/localplayer.cpp26
-rw-r--r--src/being/localplayer.h2
2 files changed, 8 insertions, 20 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index e7139642b..a14bd3383 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -2090,7 +2090,7 @@ void LocalPlayer::updateCoords()
if ((*i).x == mX && (*i).y == mY)
{
mNavigatePath.pop_front();
- fixPos(6);
+ fixPos();
break;
}
}
@@ -2452,34 +2452,22 @@ bool LocalPlayer::allowAction()
return true;
}
-/*
-bool LocalPlayer::allowMove() const
-{
- if (mIsServerBuggy)
- {
- if (mAction == MOVE)
- return false;
- }
- return true;
-}
-*/
-
-void LocalPlayer::fixPos(const int maxDist)
+void LocalPlayer::fixPos()
{
if (!mCrossX && !mCrossY)
return;
const int dx = abs(mX - mCrossX);
const int dy = abs(mY - mCrossY);
- const int dest = (dx * dx) + (dy * dy);
+ const int dist = dx > dy ? dx : dy;
const int time = cur_time;
+ const int maxDist = mSyncPlayerMove ? 2 : 5;
- if (dest > maxDist)
-// if (dest > maxDist && mActivityTime
-// && (time < mActivityTime || time - mActivityTime > 2))
+ if (dist > maxDist)
{
mActivityTime = time;
setTileCoords(mCrossX, mCrossY);
+// alternative way to fix, move to real position
// setDestination(mCrossX, mCrossY);
}
}
@@ -2514,7 +2502,7 @@ void LocalPlayer::setRealPos(const int x, const int y)
{
mCrossX = x;
mCrossY = y;
- fixPos(6);
+ fixPos();
}
}
if (mMap->isCustom())
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 7244664fb..3c0ed4286 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -272,7 +272,7 @@ class LocalPlayer final : public Being,
bool isServerBuggy() const A_WARN_UNUSED
{ return mIsServerBuggy; }
- void fixPos(const int maxDist = 1);
+ void fixPos();
/**
* Sets the map the being is on