diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-09 18:29:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-09 20:27:19 +0300 |
commit | 91ed82c45df05bc333bb63fbd92e330f9b9701c7 (patch) | |
tree | 4bac4711522e83355dbd83b4ddf2855adff73192 /src | |
parent | 5d2846414b73ebc9a3288622b03493b59fa26be9 (diff) | |
download | manaplus-91ed82c45df05bc333bb63fbd92e330f9b9701c7.tar.gz manaplus-91ed82c45df05bc333bb63fbd92e330f9b9701c7.tar.bz2 manaplus-91ed82c45df05bc333bb63fbd92e330f9b9701c7.tar.xz manaplus-91ed82c45df05bc333bb63fbd92e330f9b9701c7.zip |
Add settings for set distance for start syncyng player.
Default distance is 2 and it good for ping < 500.
But for bigger ping probably need other values.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/localplayer.cpp | 6 | ||||
-rw-r--r-- | src/being/localplayer.h | 1 | ||||
-rw-r--r-- | src/defaults.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_other.cpp | 5 |
4 files changed, 13 insertions, 2 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index a021184c0..cb4426319 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -157,6 +157,7 @@ LocalPlayer::LocalPlayer(const BeingId id, mTestParticleName(), mTestParticleTime(0), mTestParticleHash(0L), + mSyncPlayerMoveDistance(config.getBoolValue("syncPlayerMoveDistance")), mWalkingDir(0), mUpdateName(true), mBlockAdvert(false), @@ -201,6 +202,7 @@ LocalPlayer::LocalPlayer(const BeingId id, config.addListener("targetDeadPlayers", this); serverConfig.addListener("enableBuggyServers", this); config.addListener("syncPlayerMove", this); + config.addListener("syncPlayerMoveDistance", this); config.addListener("drawPath", this); config.addListener("serverAttack", this); config.addListener("attackMoving", this); @@ -1068,6 +1070,8 @@ void LocalPlayer::optionChanged(const std::string &value) mIsServerBuggy = serverConfig.getBoolValue("enableBuggyServers"); else if (value == "syncPlayerMove") mSyncPlayerMove = config.getBoolValue("syncPlayerMove"); + else if (value == "syncPlayerMoveDistance") + mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistance"); else if (value == "drawPath") mDrawPath = config.getBoolValue("drawPath"); else if (value == "serverAttack") @@ -2468,7 +2472,7 @@ void LocalPlayer::fixPos() const int dy = abs(mY - mCrossY); const int dist = dx > dy ? dx : dy; const int time = cur_time; - const int maxDist = mSyncPlayerMove ? 2 : 7; + const int maxDist = mSyncPlayerMove ? mSyncPlayerMoveDistance : 7; if (dist > maxDist) { diff --git a/src/being/localplayer.h b/src/being/localplayer.h index ccecb18fb..14d731b74 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -491,6 +491,7 @@ class LocalPlayer final : public Being, std::string mTestParticleName; int mTestParticleTime; unsigned long mTestParticleHash; + int mSyncPlayerMoveDistance; unsigned char mWalkingDir; // The direction the player is walking in. /** Whether or not the name settings have changed */ bool mUpdateName; diff --git a/src/defaults.cpp b/src/defaults.cpp index f4c7763f1..0719f3ac3 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -102,7 +102,8 @@ DefaultsData* getConfigDefaults() AddDEF("targetingType", 0); AddDEF("followMode", 0); AddDEF("imitationMode", 0); - AddDEF("syncPlayerMove", false); + AddDEF("syncPlayerMove", true); + AddDEF("syncPlayerMoveDistance", 2); AddDEF("drawPath", false); AddDEF("moveToTargetType", 10); AddDEF("crazyMoveProgram", "mumrsonmdmlon"); diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 6b9137dad..186e76fc2 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -209,6 +209,11 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : this, "syncPlayerMoveEvent"); // TRANSLATORS: settings option + new SetupItemIntTextField(_("Sync player move distance"), "", + "syncPlayerMoveDistance", + this, "syncPlayerMoveDistanceEvent", 1, 30); + + // TRANSLATORS: settings option new SetupItemTextField(_("Crazy move A program"), "", "crazyMoveProgram", this, "crazyMoveProgramEvent"); |