#pragma once /** * \file PlayerDeathPacket.h * \brief File containing the blitz::protocol::PlayerDeathPacket class */ #include "blitz/common/Defines.h" #include "blitz/protocol/Protocol.h" namespace blitz { namespace protocol { /** * \class PlayerDeathPacket * \brief Packet for when a player leaves the game. * %Packet structure : * | PacketType | * |------------------------| * | PacketType::PlayerDeath| * * | Field Name | Field Type | Notes | * |--------------------|-------------------|-------------------------------| * | m_PlayerID | PlayerID |The ID of the player that died | */ class PlayerDeathPacket : public Packet { private: game::PlayerID m_PlayerID; public: /** * \brief Default constructor. */ PlayerDeathPacket() {} /** * \brief Constructor. * \param playerID The ID of the player that died. */ PlayerDeathPacket(game::PlayerID playerID) : m_PlayerID(playerID) {} virtual ~PlayerDeathPacket() {} virtual DataBuffer Serialize(bool packetID = true) const; virtual void Deserialize(DataBuffer& data); virtual void Dispatch(PacketHandler* handler) const; /** * \brief Get the ID of the player that died. * \return The ID of the player that died. */ game::PlayerID GetPlayerID() const { return m_PlayerID; } virtual PacketType GetType() const { return PacketType::PlayerDeath; } }; } // namespace protocol } // namespace blitz