summaryrefslogtreecommitdiff
path: root/src/network/clientpackethandler.cpp
diff options
context:
space:
mode:
authorred-001 <red-001@outlook.ie>2017-06-08 14:30:09 +0100
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-08 15:30:09 +0200
commit4221c1b4412f2bf889bd603a26424003f5367f6a (patch)
tree622775e473bf073ed704afded90b050b51d63266 /src/network/clientpackethandler.cpp
parent5bd33a158688f5fb950613278eefb95b0594a765 (diff)
downloadminetest-4221c1b4412f2bf889bd603a26424003f5367f6a.tar.gz
minetest-4221c1b4412f2bf889bd603a26424003f5367f6a.tar.bz2
minetest-4221c1b4412f2bf889bd603a26424003f5367f6a.zip
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
Diffstat (limited to 'src/network/clientpackethandler.cpp')
-rw-r--r--src/network/clientpackethandler.cpp22
1 files changed, 22 insertions, 0 deletions
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)