fix: resend TagInf packet on reconnect and for new players

This commit is contained in:
Robin C. Ladiges 2023-06-24 01:27:14 +02:00
parent 4339847da5
commit 4835692672
No known key found for this signature in database
GPG key ID: B494D3DF92661B99
2 changed files with 10 additions and 0 deletions

View file

@ -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

View file

@ -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>(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);
}
}
/**