add playerlist packet
This commit is contained in:
@@ -8,11 +8,17 @@ namespace server {
|
||||
ConnectionHandler::ConnectionHandler(IServerSocket& a_Server, PlayerID a_Player) : m_Server(a_Server), m_Player(a_Player) {}
|
||||
|
||||
void ConnectionHandler::Handle(const protocol::packets::PlayerLoginPacket& a_Packet) {
|
||||
std::cout << "[Server] " << a_Packet->m_PlayerName << " tried to join !\n";
|
||||
protocol::PlayerInfo pInfo{m_Player, a_Packet->m_PlayerName};
|
||||
m_Server.OnPlayerJoin(m_Player, pInfo);
|
||||
|
||||
// TODO
|
||||
std::vector<protocol::PlayerInfo> players;
|
||||
|
||||
m_Server.Send(m_Player, protocol::packets::LoggingSuccessPacket(m_Player));
|
||||
m_Server.Send(m_Player, protocol::packets::PlayerListPacket(players));
|
||||
m_Server.Broadcast(protocol::packets::PlayerJoinPacket(pInfo));
|
||||
// TODO: send already existing players
|
||||
|
||||
m_Server.OnPlayerJoin(m_Player, pInfo);
|
||||
std::cout << "[Server] " << a_Packet->m_PlayerName << " tried to join !\n";
|
||||
}
|
||||
|
||||
void ConnectionHandler::Handle(const protocol::packets::DisconnectPacket& a_Packet) {
|
||||
|
||||
Reference in New Issue
Block a user