From 4221c1b4412f2bf889bd603a26424003f5367f6a Mon Sep 17 00:00:00 2001 From: red-001 Date: Thu, 8 Jun 2017 14:30:09 +0100 Subject: Have the server send the player list to the client (#5924) * Have the server send the player list to the client Currently the client generates the player list based on the Client active object list, the issue with this is that we can't be sure all player active objects will be sent to the client, so this could result in players showing up when someone run `/status` but auto complete not working with their nick and CSM not being aware of the player --- src/network/clientpackethandler.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/network/clientpackethandler.cpp') diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index d002ae10d..9eb6d8dca 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -1270,6 +1270,28 @@ void Client::handleCommand_EyeOffset(NetworkPacket* pkt) *pkt >> player->eye_offset_first >> player->eye_offset_third; } +void Client::handleCommand_UpdatePlayerList(NetworkPacket* pkt) +{ + u8 type; + u16 num_players; + *pkt >> type >> num_players; + PlayerListModifer notice_type = (PlayerListModifer) type; + + for (u16 i = 0; i < num_players; i++) { + std::string name; + *pkt >> name; + switch (notice_type) { + case PLAYER_LIST_INIT: + case PLAYER_LIST_ADD: + m_env.addPlayerName(name); + continue; + case PLAYER_LIST_REMOVE: + m_env.removePlayerName(name); + continue; + } + } +} + void Client::handleCommand_SrpBytesSandB(NetworkPacket* pkt) { if ((m_chosen_auth_mech != AUTH_MECHANISM_LEGACY_PASSWORD) -- cgit v1.2.3