diff options
author | sfan5 <sfan5@live.de> | 2022-02-14 21:01:42 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-05-14 18:33:42 +0200 |
commit | 23d49fda294b84b263f4ebb5c3b900ee17468f9e (patch) | |
tree | 48153219180abe03f084413030635729c6cbc590 /src/server.cpp | |
parent | 62ad2c3bc1dd3a1a70d9eefbe2fac8fcbe426a1b (diff) | |
download | minetest-23d49fda294b84b263f4ebb5c3b900ee17468f9e.tar.gz minetest-23d49fda294b84b263f4ebb5c3b900ee17468f9e.tar.bz2 minetest-23d49fda294b84b263f4ebb5c3b900ee17468f9e.zip |
Clean up ClientReady packet handling
fixes #12073
Diffstat (limited to 'src/server.cpp')
-rw-r--r-- | src/server.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/server.cpp b/src/server.cpp index 23a7dc5a0..b3fb037b5 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1106,20 +1106,21 @@ PlayerSAO* Server::StageTwoClientInit(session_t peer_id) SendPlayerBreath(playersao); /* - Print out action + Update player list and print action */ { - Address addr = getPeerAddress(player->getPeerId()); - std::string ip_str = addr.serializeString(); - const std::vector<std::string> &names = m_clients.getPlayerNames(); + NetworkPacket notice_pkt(TOCLIENT_UPDATE_PLAYER_LIST, 0, PEER_ID_INEXISTENT); + notice_pkt << (u8) PLAYER_LIST_ADD << (u16) 1 << std::string(player->getName()); + m_clients.sendToAll(¬ice_pkt); + } + { + std::string ip_str = getPeerAddress(player->getPeerId()).serializeString(); + const auto &names = m_clients.getPlayerNames(); actionstream << player->getName() << " [" << ip_str << "] joins game. List of players: "; - - for (const std::string &name : names) { + for (const std::string &name : names) actionstream << name << " "; - } - - actionstream << player->getName() <<std::endl; + actionstream << player->getName() << std::endl; } return playersao; } |