aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-02-14 21:01:42 +0100
committersfan5 <sfan5@live.de>2022-02-17 23:20:33 +0100
commitc31b3017222edd6e93bdeb02f05a3df7b6b23a1a (patch)
treeb63fef4985c7479bfada04724f91b0d1be02d3e1 /src/server.cpp
parent5d0b18a0d0bd02a9b77b8948d6887bb661a385da (diff)
downloadminetest-c31b3017222edd6e93bdeb02f05a3df7b6b23a1a.tar.gz
minetest-c31b3017222edd6e93bdeb02f05a3df7b6b23a1a.tar.bz2
minetest-c31b3017222edd6e93bdeb02f05a3df7b6b23a1a.zip
Clean up ClientReady packet handling
fixes #12073
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 76345686a..685d8bb25 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1104,20 +1104,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(&notice_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;
}