diff options
author | Andrei Karas <akaras@inbox.ru> | 2019-04-08 19:26:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2019-04-08 19:26:31 +0300 |
commit | b6043379e6b8035a7e494c5c9045c4785329d63a (patch) | |
tree | 0d8a4972538ae31214072b84ac6595ccd1fbb064 | |
parent | 690adf11698d656acbe13caed9675993f6516365 (diff) | |
download | mv-b6043379e6b8035a7e494c5c9045c4785329d63a.tar.gz mv-b6043379e6b8035a7e494c5c9045c4785329d63a.tar.bz2 mv-b6043379e6b8035a7e494c5c9045c4785329d63a.tar.xz mv-b6043379e6b8035a7e494c5c9045c4785329d63a.zip |
Add separate auto move sync distance for legacy servers
-rw-r--r-- | src/being/localplayer.cpp | 39 | ||||
-rw-r--r-- | src/defaults.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_misc.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwa/generalhandler.cpp | 1 |
4 files changed, 45 insertions, 3 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 840417803..646125f19 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -153,7 +153,13 @@ LocalPlayer::LocalPlayer(const BeingId id, mTestParticleName(), mTestParticleTime(0), mTestParticleHash(0L), +#ifdef TMWA_SUPPORT + mSyncPlayerMoveDistance(Net::getNetworkType() == ServerType::TMWATHENA ? + config.getIntValue("syncPlayerMoveDistanceLegacy") : + config.getIntValue("syncPlayerMoveDistance")), +#else mSyncPlayerMoveDistance(config.getIntValue("syncPlayerMoveDistance")), +#endif mUnfreezeTime(0), mWalkingDir(0), mUpdateName(true), @@ -207,6 +213,9 @@ LocalPlayer::LocalPlayer(const BeingId id, serverConfig.addListener("enableBuggyServers", this); config.addListener("syncPlayerMove", this); config.addListener("syncPlayerMoveDistance", this); +#ifdef TMWA_SUPPORT + config.addListener("syncPlayerMoveDistanceLegacy", this); +#endif config.addListener("drawPath", this); config.addListener("serverAttack", this); config.addListener("attackMoving", this); @@ -1126,8 +1135,18 @@ void LocalPlayer::optionChanged(const std::string &value) } else if (value == "syncPlayerMoveDistance") { - mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistance"); +#ifdef TMWA_SUPPORT + if (Net::getNetworkType() != ServerType::TMWATHENA) +#endif + mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistance"); } +#ifdef TMWA_SUPPORT + else if (value == "syncPlayerMoveDistanceLegacy") + { + if (Net::getNetworkType() == ServerType::TMWATHENA) + mSyncPlayerMoveDistance = config.getIntValue("syncPlayerMoveDistanceLegacy"); + } +#endif else if (value == "drawPath") { mDrawPath = config.getBoolValue("drawPath"); @@ -2588,7 +2607,23 @@ void LocalPlayer::fixPos() const int dy = (mY >= mCrossY) ? mY - mCrossY : mCrossY - mY; const int dist = dx > dy ? dx : dy; const time_t time = cur_time; - const int maxDist = mSyncPlayerMove ? mSyncPlayerMoveDistance : 7; + +#ifdef TMWA_SUPPORT + int maxDist; + if (mSyncPlayerMove) + { + maxDist = mSyncPlayerMoveDistance; + } + else + { + if (Net::getNetworkType() == ServerType::TMWATHENA) + maxDist = 30; + else + maxDist = 10; + } +#else + const int maxDist = mSyncPlayerMove ? mSyncPlayerMoveDistance : 10; +#endif if (dist > maxDist) { diff --git a/src/defaults.cpp b/src/defaults.cpp index 337d1e89a..0907e15d7 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -118,6 +118,7 @@ void setConfigDefaults(Configuration &cfg) AddDEF("imitationMode", 0); AddDEF("syncPlayerMove", true); AddDEF("syncPlayerMoveDistance", 5); + AddDEF("syncPlayerMoveDistanceLegacy", 15); AddDEF("drawPath", false); AddDEF("moveToTargetType", 10); AddDEF("crazyMoveProgram", "mumrsonmdmlon"); diff --git a/src/gui/widgets/tabs/setup_misc.cpp b/src/gui/widgets/tabs/setup_misc.cpp index 90d685fef..40276a59e 100644 --- a/src/gui/widgets/tabs/setup_misc.cpp +++ b/src/gui/widgets/tabs/setup_misc.cpp @@ -266,6 +266,13 @@ Setup_Misc::Setup_Misc(const Widget2 *const widget) : MainConfig_true); // TRANSLATORS: settings option + new SetupItemIntTextField(_("Sync player move distance on legacy servers"), + "", + "syncPlayerMoveDistanceLegacy", + this, "syncPlayerMoveDistanceLegacyEvent", 1, 30, + MainConfig_true); + + // TRANSLATORS: settings option new SetupItemTextField(_("Crazy move A program"), "", "crazyMoveProgram", this, "crazyMoveProgramEvent", MainConfig_true, UseBase64_false); diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 7e5eb70de..16b2445bf 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -23,7 +23,6 @@ #include "net/tmwa/generalhandler.h" #include "client.h" -#include "configuration.h" #include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" |