Fix buddy list not syncing properly

I couldn't reproduce this on my public server, but the list would show up empty sometimes on initial login on my local server, so I threw it in for good measure.
This commit is contained in:
Gent 2020-11-08 13:58:44 -05:00
parent 30de5c1734
commit 3f5a9c8811
3 changed files with 11 additions and 1 deletions

View File

@ -338,6 +338,15 @@ void BuddyManager::reqBuddyMenuchat(CNSocket* sock, CNPacketData* data) {
// Getting buddy state // Getting buddy state
void BuddyManager::reqPktGetBuddyState(CNSocket* sock, CNPacketData* data) { void BuddyManager::reqPktGetBuddyState(CNSocket* sock, CNPacketData* data) {
Player* plr = PlayerManager::getPlayer(sock); Player* plr = PlayerManager::getPlayer(sock);
/*
* If the buddy list wasn't synced a second time yet, sync it.
* Not sure why we have to do it again for the client not to trip up.
*/
if (!plr->buddiesSynced) {
refreshBuddyList(sock);
plr->buddiesSynced = true;
}
INITSTRUCT(sP_FE2CL_REP_GET_BUDDY_STATE_SUCC, resp); INITSTRUCT(sP_FE2CL_REP_GET_BUDDY_STATE_SUCC, resp);

View File

@ -71,5 +71,6 @@ struct Player {
bool notify; bool notify;
bool buddiesSynced;
int64_t buddyIDs[50]; int64_t buddyIDs[50];
}; };

View File

@ -404,7 +404,7 @@ void PlayerManager::enterPlayer(CNSocket* sock, CNPacketData* data) {
MissionManager::failInstancedMissions(sock); MissionManager::failInstancedMissions(sock);
// send over buddy list // initial buddy sync
BuddyManager::refreshBuddyList(sock); BuddyManager::refreshBuddyList(sock);
for (auto& pair : PlayerManager::players) for (auto& pair : PlayerManager::players)