mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-04 19:36:43 +03:00
37 lines
705 B
C++
37 lines
705 B
C++
#include "Packet.hpp"
|
|
|
|
AddPlayerPacket::AddPlayerPacket(const RakNet::RakNetGUID& guid, RakNet::RakString name, int id, float x, float y, float z)
|
|
{
|
|
m_guid = guid;
|
|
m_name = name;
|
|
m_id = id;
|
|
m_x = x;
|
|
m_y = y;
|
|
m_z = z;
|
|
}
|
|
|
|
void AddPlayerPacket::handle(const RakNet::RakNetGUID& guid, NetEventCallback* pCallback)
|
|
{
|
|
pCallback->handle(guid, this);
|
|
}
|
|
|
|
void AddPlayerPacket::write(RakNet::BitStream* bs)
|
|
{
|
|
bs->Write(PACKET_ADD_PLAYER);
|
|
bs->Write(m_guid);
|
|
bs->Write(m_name);
|
|
bs->Write(m_id);
|
|
bs->Write(m_x);
|
|
bs->Write(m_y);
|
|
bs->Write(m_z);
|
|
}
|
|
|
|
void AddPlayerPacket::read(RakNet::BitStream* bs)
|
|
{
|
|
bs->Read(m_guid);
|
|
bs->Read(m_name);
|
|
bs->Read(m_id);
|
|
bs->Read(m_x);
|
|
bs->Read(m_y);
|
|
bs->Read(m_z);
|
|
} |