diff --git a/include/server/Client.hpp b/include/server/Client.hpp index 7d3d898..fc09a68 100644 --- a/include/server/Client.hpp +++ b/include/server/Client.hpp @@ -225,6 +225,8 @@ class Client { GameInf lastGameInfPacket = GameInf(); GameInf emptyGameInfPacket = GameInf(); CostumeInf lastCostumeInfPacket = CostumeInf(); + TagInf lastTagInfPacket = TagInf(); + CaptureInf lastCaptureInfPacket = CaptureInf(); Keyboard* mKeyboard = nullptr; // keyboard for setting server IP diff --git a/source/server/Client.cpp b/source/server/Client.cpp index 24b6bee..f38cc77 100644 --- a/source/server/Client.cpp +++ b/source/server/Client.cpp @@ -348,6 +348,10 @@ void Client::readFunc() { mSocket->send(&lastPlayerInfPacket); if (lastCostumeInfPacket.mUserID == mUserID) mSocket->send(&lastCostumeInfPacket); + if (lastTagInfPacket.mUserID == mUserID) + mSocket->send(&lastTagInfPacket); + if (lastCaptureInfPacket.mUserID == mUserID) + mSocket->send(&lastCaptureInfPacket); break; case PacketType::COSTUMEINF: @@ -616,6 +620,8 @@ void Client::sendTagInfPacket() { packet->updateType = static_cast(TagUpdateType::STATE | TagUpdateType::TIME); sInstance->mSocket->queuePacket(packet); + + sInstance->lastTagInfPacket = *packet; } /** @@ -660,12 +666,14 @@ void Client::sendCaptureInfPacket(const PlayerActorHakoniwa* player) { packet->mUserID = sInstance->mUserID; strcpy(packet->hackName, tryConvertName(player->mHackKeeper->getCurrentHackName())); sInstance->mSocket->queuePacket(packet); + sInstance->lastCaptureInfPacket = *packet; sInstance->isSentCaptureInf = true; } else if (!sInstance->isClientCaptured && sInstance->isSentCaptureInf) { CaptureInf *packet = new CaptureInf(); packet->mUserID = sInstance->mUserID; strcpy(packet->hackName, ""); sInstance->mSocket->queuePacket(packet); + sInstance->lastCaptureInfPacket = *packet; sInstance->isSentCaptureInf = false; } } @@ -683,6 +691,16 @@ void Client::resendInitPackets() { if (lastGameInfPacket != emptyGameInfPacket) { mSocket->queuePacket(&lastGameInfPacket); } + + // TagInfPacket + if (lastTagInfPacket.mUserID == mUserID) { + mSocket->queuePacket(&lastTagInfPacket); + } + + // CaptureInfPacket + if (lastCaptureInfPacket.mUserID == mUserID) { + mSocket->queuePacket(&lastCaptureInfPacket); + } } /** diff --git a/source/server/SocketClient.cpp b/source/server/SocketClient.cpp index 2389cc7..9495df2 100644 --- a/source/server/SocketClient.cpp +++ b/source/server/SocketClient.cpp @@ -104,6 +104,21 @@ nn::Result SocketClient::init(const char* ip, u16 port) { // on a reconnect, resend some maybe missing packets if (initPacket.conType == ConnectionTypes::RECONNECT) { client->resendInitPackets(); + } else { + // empty TagInf + TagInf tagInf; + tagInf.mUserID = initPacket.mUserID; + tagInf.isIt = false; + tagInf.minutes = 0; + tagInf.seconds = 0; + tagInf.updateType = static_cast(TagUpdateType::STATE | TagUpdateType::TIME); + send(&tagInf); + + // empty CaptureInf + CaptureInf capInf; + capInf.mUserID = initPacket.mUserID; + strcpy(capInf.hackName, ""); + send(&capInf); } return result;