add playerlist packet
This commit is contained in:
@@ -27,16 +27,16 @@ struct MapData {
|
||||
|
||||
namespace pdata {
|
||||
|
||||
/** Client attempts to login (very basic) */
|
||||
struct PlayerLogin {
|
||||
std::string m_PlayerName;
|
||||
};
|
||||
|
||||
/** Server indicates success */
|
||||
struct LoggingSuccess {
|
||||
PlayerID m_PlayerId;
|
||||
};
|
||||
|
||||
/** Client attempts to login (very basic) */
|
||||
struct PlayerLogin {
|
||||
std::string m_PlayerName;
|
||||
};
|
||||
|
||||
/** Player joins the lobby */
|
||||
struct PlayerJoin {
|
||||
PlayerInfo m_Player;
|
||||
@@ -47,6 +47,11 @@ struct PlayerLeave {
|
||||
PlayerID m_PlayerId;
|
||||
};
|
||||
|
||||
/** List of players who joined before */
|
||||
struct PlayerList {
|
||||
std::vector<PlayerInfo> m_Players;
|
||||
};
|
||||
|
||||
struct PredictCommand {
|
||||
CommandPtr m_Command;
|
||||
StepTime m_FrameNumber;
|
||||
|
||||
@@ -29,6 +29,7 @@ enum class PacketID : std::uint8_t {
|
||||
PlaceTower,
|
||||
PlayerJoin,
|
||||
PlayerLeave,
|
||||
PlayerList,
|
||||
PlayerLogin,
|
||||
PredictCommand,
|
||||
SpawnTroop,
|
||||
@@ -58,6 +59,7 @@ using LoggingSuccessPacket = PacketMessage<pdata::LoggingSuccess, PacketID::Logg
|
||||
using PlaceTowerPacket = PacketMessage<pdata::PlaceTower, PacketID::PlaceTower>;
|
||||
using PlayerJoinPacket = PacketMessage<pdata::PlayerJoin, PacketID::PlayerJoin>;
|
||||
using PlayerLeavePacket = PacketMessage<pdata::PlayerLeave, PacketID::PlayerLeave>;
|
||||
using PlayerListPacket = PacketMessage<pdata::PlayerList, PacketID::PlayerList>;
|
||||
using PlayerLoginPacket = PacketMessage<pdata::PlayerLogin, PacketID::PlayerLogin>;
|
||||
using PredictCommandPacket = PacketMessage<pdata::PredictCommand, PacketID::PredictCommand>;
|
||||
using SpawnTroopPacket = PacketMessage<pdata::SpawnTroop, PacketID::SpawnTroop>;
|
||||
@@ -66,11 +68,11 @@ using WorldDataPacket = PacketMessage<pdata::WorldData, PacketID::WorldData>;
|
||||
|
||||
} // namespace packets
|
||||
|
||||
using AllPackets =
|
||||
std::tuple<packets::BeginGamePacket, packets::ChatMessagePacket, packets::DisconnectPacket, packets::KeepAlivePacket,
|
||||
packets::LockStepRequestPacket, packets::LockStepResponsePacket, packets::LockStepsPacket, packets::LoggingSuccessPacket,
|
||||
packets::PlaceTowerPacket, packets::PlayerJoinPacket, packets::PlayerLeavePacket, packets::PlayerLoginPacket,
|
||||
packets::PredictCommandPacket, packets::SpawnTroopPacket, packets::WorldHeaderPacket, packets::WorldDataPacket>;
|
||||
using AllPackets = std::tuple<packets::BeginGamePacket, packets::ChatMessagePacket, packets::DisconnectPacket,
|
||||
packets::KeepAlivePacket, packets::LockStepRequestPacket, packets::LockStepResponsePacket, packets::LockStepsPacket,
|
||||
packets::LoggingSuccessPacket, packets::PlaceTowerPacket, packets::PlayerJoinPacket, packets::PlayerLeavePacket,
|
||||
packets::PlayerListPacket, packets::PlayerLoginPacket, packets::PredictCommandPacket, packets::SpawnTroopPacket,
|
||||
packets::WorldHeaderPacket, packets::WorldDataPacket>;
|
||||
|
||||
class PacketHandler : public sp::GenericHandler<AllPackets> {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user