From 0e3549dd92ac1eac1916b3f5110036ab59fe2fec Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 20 Mar 2019 22:14:01 +0300 Subject: Possible fix for desync in moving Handle player stop packet always. Check desync always if tile changed client side. Check desync always if server move response packet received. Removed unused configuration option. --- src/net/ea/beinghandler.cpp | 3 +-- src/net/ea/beinghandler.h | 2 +- src/net/ea/beingrecv.cpp | 3 +-- src/net/eathena/beinghandler.cpp | 4 ++-- src/net/eathena/beinghandler.h | 2 +- src/net/eathena/generalhandler.cpp | 2 +- src/net/messagein.cpp | 27 +++++++++++++++------------ src/net/tmwa/beinghandler.cpp | 4 ++-- src/net/tmwa/beinghandler.h | 2 +- src/net/tmwa/generalhandler.cpp | 2 +- 10 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 2870bc85b..511154fd5 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -29,10 +29,9 @@ namespace Ea { -BeingHandler::BeingHandler(const bool enableSync) : +BeingHandler::BeingHandler() : Net::BeingHandler() { - BeingRecv::mSync = enableSync; BeingRecv::mSpawnId = BeingId_zero; } diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h index a151601bc..8c90dbf01 100644 --- a/src/net/ea/beinghandler.h +++ b/src/net/ea/beinghandler.h @@ -34,7 +34,7 @@ class BeingHandler notfinal : public Net::BeingHandler A_DELETE_COPY(BeingHandler) protected: - explicit BeingHandler(const bool enableSync); + explicit BeingHandler(); }; } // namespace Ea diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp index 4ac1f90eb..ed6e031b6 100644 --- a/src/net/ea/beingrecv.cpp +++ b/src/net/ea/beingrecv.cpp @@ -54,7 +54,6 @@ namespace Ea namespace BeingRecv { - bool mSync = false; BeingId mSpawnId = BeingId_zero; } // namespace BeingRecv @@ -345,7 +344,7 @@ void BeingRecv::processPlayerStop(Net::MessageIn &msg) const BeingId id = msg.readBeingId("account id"); - if (mSync || id != localPlayer->getId()) +// if (mSync || id != localPlayer->getId()) { Being *const dstBeing = actorManager->findBeing(id); if (dstBeing != nullptr) diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 7e8dc43e2..c132609e3 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -34,8 +34,8 @@ extern int serverVersion; namespace EAthena { -BeingHandler::BeingHandler(const bool enableSync) : - Ea::BeingHandler(enableSync) +BeingHandler::BeingHandler() : + Ea::BeingHandler() { beingHandler = this; } diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h index 6372ea336..41dafb6aa 100644 --- a/src/net/eathena/beinghandler.h +++ b/src/net/eathena/beinghandler.h @@ -31,7 +31,7 @@ namespace EAthena class BeingHandler final : public Ea::BeingHandler { public: - explicit BeingHandler(const bool enableSync); + explicit BeingHandler(); A_DELETE_COPY(BeingHandler) diff --git a/src/net/eathena/generalhandler.cpp b/src/net/eathena/generalhandler.cpp index ff420092d..1226e03f9 100644 --- a/src/net/eathena/generalhandler.cpp +++ b/src/net/eathena/generalhandler.cpp @@ -83,7 +83,7 @@ namespace EAthena GeneralHandler::GeneralHandler() : mAdminHandler(new AdminHandler), - mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), + mBeingHandler(new BeingHandler), mBuySellHandler(new BuySellHandler), mCharServerHandler(new CharServerHandler), mChatHandler(new ChatHandler), diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index bdac098c5..22d0510ce 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -473,20 +473,23 @@ unsigned char *MessageIn::readBytes(int length, const char *const dstr) mPos += length; #ifdef ENABLEDEBUGLOG - std::string str; - for (int f = 0; f < length; f ++) - str.append(strprintf("%02x", CAST_U32(buf[f]))); - str += " "; - for (int f = 0; f < length; f ++) + if (!mIgnore) { - if (buf[f] != 0U) - str.append(strprintf("%c", buf[f])); - else - str.append("_"); + std::string str; + for (int f = 0; f < length; f ++) + str.append(strprintf("%02x", CAST_U32(buf[f]))); + str += " "; + for (int f = 0; f < length; f ++) + { + if (buf[f] != 0U) + str.append(strprintf("%c", buf[f])); + else + str.append("_"); + } + if (dstr != nullptr) + logger->dlog(dstr); + logger->dlog("ReadBytes: " + str); } - if (dstr != nullptr) - logger->dlog(dstr); - logger->dlog("ReadBytes: " + str); #endif // ENABLEDEBUGLOG PacketCounters::incInBytes(length); diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index e944fa835..f3d3acdf8 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -31,8 +31,8 @@ namespace TmwAthena { -BeingHandler::BeingHandler(const bool enableSync) : - Ea::BeingHandler(enableSync) +BeingHandler::BeingHandler() : + Ea::BeingHandler() { beingHandler = this; } diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h index ed486c9ee..32e01db1f 100644 --- a/src/net/tmwa/beinghandler.h +++ b/src/net/tmwa/beinghandler.h @@ -31,7 +31,7 @@ namespace TmwAthena class BeingHandler final : public Ea::BeingHandler { public: - explicit BeingHandler(const bool enableSync); + explicit BeingHandler(); A_DELETE_COPY(BeingHandler) diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 994be2ce7..7e5eb70de 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -82,7 +82,7 @@ namespace TmwAthena GeneralHandler::GeneralHandler() : mAdminHandler(new AdminHandler), - mBeingHandler(new BeingHandler(config.getBoolValue("EnableSync"))), + mBeingHandler(new BeingHandler), mBuySellHandler(new BuySellHandler), mCharServerHandler(new CharServerHandler), mChatHandler(new ChatHandler), -- cgit v1.2.3-70-g09d2