From 48356926727033f5b8bcb4556b5e35614c55f6f2 Mon Sep 17 00:00:00 2001 From: "Robin C. Ladiges" Date: Sat, 24 Jun 2023 01:27:14 +0200 Subject: [PATCH] fix: resend TagInf packet on reconnect and for new players --- include/server/Client.hpp | 1 + source/server/Client.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/server/Client.hpp b/include/server/Client.hpp index 028fee9..5a0b4a3 100644 --- a/include/server/Client.hpp +++ b/include/server/Client.hpp @@ -229,6 +229,7 @@ class Client { GameInf lastGameInfPacket = GameInf(); GameInf emptyGameInfPacket = GameInf(); CostumeInf lastCostumeInfPacket = CostumeInf(); + TagInf lastTagInfPacket = TagInf(); Keyboard* mKeyboard = nullptr; // keyboard for setting server IP diff --git a/source/server/Client.cpp b/source/server/Client.cpp index 4457ef0..cb59fe2 100644 --- a/source/server/Client.cpp +++ b/source/server/Client.cpp @@ -361,6 +361,8 @@ void Client::readFunc() { mSocket->send(&lastPlayerInfPacket); if (lastCostumeInfPacket.mUserID == mUserID) mSocket->send(&lastCostumeInfPacket); + if (lastTagInfPacket.mUserID == mUserID) + mSocket->send(&lastTagInfPacket); break; case PacketType::COSTUMEINF: @@ -629,6 +631,8 @@ void Client::sendTagInfPacket() { packet->updateType = static_cast(TagUpdateType::STATE | TagUpdateType::TIME); sInstance->mSocket->queuePacket(packet); + + sInstance->lastTagInfPacket = *packet; } /** @@ -696,6 +700,11 @@ void Client::resendInitPackets() { if (lastGameInfPacket != emptyGameInfPacket) { mSocket->queuePacket(&lastGameInfPacket); } + + // TagInfPacket + if (lastTagInfPacket.mUserID == mUserID) { + mSocket->queuePacket(&lastTagInfPacket); + } } /**