mirror of
https://github.com/celisej567/mcpe.git
synced 2026-09-11 20:11:18 +03:00
* Initial commit.
:)
This commit is contained in:
37
source/Network/Packets/AddPlayerPacket.cpp
Normal file
37
source/Network/Packets/AddPlayerPacket.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user