summaryrefslogtreecommitdiff
path: root/src/being/localplayer.cpp
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/localplayer.cpp
parent1708cce0de3c195b0ecaa8a5f8383712dc0d4c13 (diff)
downloadManaVerse-387d06f36504e65a9ce82984944fc844181c80fe.tar.gz
ManaVerse-387d06f36504e65a9ce82984944fc844181c80fe.tar.bz2
ManaVerse-387d06f36504e65a9ce82984944fc844181c80fe.tar.xz
ManaVerse-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/localplayer.cpp')
-rw-r--r--src/being/localplayer.cpp26
1 files changed, 7 insertions, 19 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())