2016-10-17 12:54:36 +00:00
|
|
|
#ifndef OPENMW_PLAYERPACKET_HPP
|
|
|
|
#define OPENMW_PLAYERPACKET_HPP
|
2016-01-12 03:41:44 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <RakNetTypes.h>
|
|
|
|
#include <BitStream.h>
|
|
|
|
#include <PacketPriority.h>
|
|
|
|
#include <components/openmw-mp/Base/BasePlayer.hpp>
|
|
|
|
|
2016-10-19 16:37:10 +00:00
|
|
|
#include <components/openmw-mp/Packets/BasePacket.hpp>
|
2016-10-17 15:47:16 +00:00
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
|
|
|
|
namespace mwmp
|
|
|
|
{
|
2016-10-17 15:47:16 +00:00
|
|
|
class PlayerPacket : public BasePacket
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-10-17 12:54:36 +00:00
|
|
|
PlayerPacket(RakNet::RakPeerInterface *peer);
|
2016-01-12 03:41:44 +00:00
|
|
|
|
2016-10-17 12:54:36 +00:00
|
|
|
~PlayerPacket();
|
2016-01-12 03:41:44 +00:00
|
|
|
|
|
|
|
virtual void Packet(RakNet::BitStream *bs, BasePlayer *player, bool send);
|
|
|
|
|
|
|
|
virtual void Send(BasePlayer *player, bool toOtherPlayers = true);
|
|
|
|
virtual void Send(BasePlayer *player, RakNet::AddressOrGUID destination);
|
|
|
|
virtual void Read(BasePlayer *player);
|
|
|
|
|
2016-08-17 23:42:08 +00:00
|
|
|
static size_t headerSize()
|
2016-01-12 03:41:44 +00:00
|
|
|
{
|
2016-09-04 10:38:49 +00:00
|
|
|
return (size_t)(1 + RakNet::RakNetGUID::size()); // packetID + RakNetGUID (uint64_t)
|
2016-01-12 03:41:44 +00:00
|
|
|
}
|
|
|
|
|
2016-08-29 13:03:04 +00:00
|
|
|
unsigned char GetPacketID()
|
|
|
|
{
|
|
|
|
return packetID;
|
|
|
|
}
|
|
|
|
|
2016-01-12 03:41:44 +00:00
|
|
|
protected:
|
|
|
|
BasePlayer *player;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-10-17 12:54:36 +00:00
|
|
|
#endif //OPENMW_PLAYERPACKET_HPP
|