summaryrefslogtreecommitdiffstats
path: root/source/packets/cPacket_Metadata.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-07 21:49:52 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-07 21:49:52 +0100
commitb7d524423c23470cd11e720eeb48368c072838cb (patch)
treef1478e6d8e9dc68332f493595e1f9265c964e68c /source/packets/cPacket_Metadata.cpp
parentcSocketThreads initial commit. Not yet tested and not yet integrated (diff)
downloadcuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.gz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.bz2
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.lz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.xz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.zst
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.zip
Diffstat (limited to 'source/packets/cPacket_Metadata.cpp')
-rw-r--r--source/packets/cPacket_Metadata.cpp47
1 files changed, 32 insertions, 15 deletions
diff --git a/source/packets/cPacket_Metadata.cpp b/source/packets/cPacket_Metadata.cpp
index e130f86fc..9d2d61704 100644
--- a/source/packets/cPacket_Metadata.cpp
+++ b/source/packets/cPacket_Metadata.cpp
@@ -17,6 +17,10 @@ cPacket_Metadata::cPacket_Metadata(int s, int id)
FormPacket();
}
+
+
+
+
cPacket_Metadata::cPacket_Metadata()
: m_UniqueID( 0 )
, m_Type( 0 )
@@ -27,19 +31,30 @@ cPacket_Metadata::cPacket_Metadata()
FormPacket();
}
-cPacket_Metadata::~cPacket_Metadata() {
- //if( m_MetaData ) delete [] m_MetaData;
+
+
+
+
+cPacket_Metadata::~cPacket_Metadata()
+{
+ delete [] m_MetaData;
}
-void cPacket_Metadata::FormPacket() {
- if( m_MetaData ) delete [] m_MetaData;
+
+
+
+
+void cPacket_Metadata::FormPacket()
+{
+ delete [] m_MetaData;
m_MetaData = new char[3];
m_MetaDataSize = 3;
- //m_UniqueID = GetUniqueID();
+ // m_UniqueID = GetUniqueID();
m_MetaData[0] = 0x00;
m_MetaData[2] = 0x7f;
- switch(m_EMetaData) {
+ switch(m_EMetaData)
+ {
case cPawn::NORMAL:
m_MetaData[1] = 0x00;
break;
@@ -65,15 +80,17 @@ void cPacket_Metadata::FormPacket() {
}
}
-bool cPacket_Metadata::Send(cSocket & a_Socket) {
- unsigned int TotalSize = c_Size + m_MetaDataSize;
- char* Message = new char[TotalSize];
- unsigned int i = 0;
- AppendByte ( (char)m_PacketID, Message, i );
- AppendInteger ( m_UniqueID, Message, i );
- AppendData ( m_MetaData, m_MetaDataSize, Message, i );
- bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
- return RetVal;
+
+
+void cPacket_Metadata::Serialize(AString & a_Data) const
+{
+ AppendByte (a_Data, m_PacketID);
+ AppendInteger(a_Data, m_UniqueID);
+ AppendData (a_Data, m_MetaData, m_MetaDataSize);
}
+
+
+
+