40 lines
766 B
C++
40 lines
766 B
C++
#pragma once
|
|
|
|
#include <map>
|
|
|
|
#include "blitz/protocol/Protocol.h"
|
|
|
|
namespace blitz {
|
|
namespace protocol {
|
|
|
|
struct PlayerInfo {
|
|
std::string name;
|
|
};
|
|
|
|
typedef std::map<std::uint8_t, PlayerInfo> PlayerList;
|
|
|
|
class PlayerListPacket : public Packet {
|
|
private:
|
|
PlayerList m_Players;
|
|
|
|
public:
|
|
PlayerListPacket() {}
|
|
PlayerListPacket(const PlayerList& players) : m_Players(players) {}
|
|
virtual ~PlayerListPacket() {}
|
|
|
|
virtual DataBuffer Serialize(bool packetID = true) const;
|
|
virtual void Deserialize(DataBuffer& data);
|
|
virtual void Dispatch(PacketHandler* handler) const;
|
|
|
|
const PlayerList& GetPlayers() const {
|
|
return m_Players;
|
|
}
|
|
|
|
virtual PacketType GetType() const {
|
|
return PacketType::PlayerList;
|
|
}
|
|
};
|
|
|
|
} // namespace protocol
|
|
} // namespace blitz
|