2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
#include "cPacket_Metadata.h"
|
|
|
|
|
2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_Metadata::cPacket_Metadata(int s, int id)
|
2011-12-27 21:10:05 -05:00
|
|
|
: m_EMetaData( (cPawn::MetaData)s )
|
2011-10-03 14:41:19 -04:00
|
|
|
, m_UniqueID( id )
|
|
|
|
, m_Type( 0 )
|
|
|
|
, m_MetaData( 0 )
|
|
|
|
{
|
|
|
|
m_PacketID = E_METADATA;
|
|
|
|
FormPacket();
|
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_Metadata::cPacket_Metadata()
|
2011-12-27 21:10:05 -05:00
|
|
|
: m_UniqueID( 0 )
|
2011-10-03 14:41:19 -04:00
|
|
|
, m_Type( 0 )
|
|
|
|
, m_MetaData( 0 )
|
|
|
|
{
|
|
|
|
m_PacketID = E_METADATA;
|
2011-12-27 21:10:05 -05:00
|
|
|
m_EMetaData = cPawn::NORMAL;
|
2011-10-03 14:41:19 -04:00
|
|
|
FormPacket();
|
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-13 16:47:03 -05:00
|
|
|
cPacket_Metadata::cPacket_Metadata(const cPacket_Metadata & a_Other)
|
|
|
|
: m_EMetaData( a_Other.m_EMetaData )
|
|
|
|
, m_UniqueID( a_Other.m_UniqueID )
|
|
|
|
, m_Type( a_Other.m_Type )
|
|
|
|
, m_MetaData( NULL )
|
|
|
|
{
|
|
|
|
m_PacketID = E_METADATA;
|
|
|
|
FormPacket();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
cPacket_Metadata::~cPacket_Metadata()
|
|
|
|
{
|
|
|
|
delete [] m_MetaData;
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPacket_Metadata::FormPacket()
|
|
|
|
{
|
|
|
|
delete [] m_MetaData;
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData = new char[3];
|
|
|
|
m_MetaDataSize = 3;
|
2012-02-07 15:49:52 -05:00
|
|
|
// m_UniqueID = GetUniqueID();
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[0] = 0x00;
|
2011-12-27 21:10:05 -05:00
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[2] = 0x7f;
|
2012-02-07 15:49:52 -05:00
|
|
|
switch(m_EMetaData)
|
|
|
|
{
|
2011-12-27 21:10:05 -05:00
|
|
|
case cPawn::NORMAL:
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[1] = 0x00;
|
|
|
|
break;
|
2011-12-27 21:10:05 -05:00
|
|
|
case cPawn::BURNING:
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[1] = 0x01;
|
|
|
|
break;
|
2011-12-27 21:10:05 -05:00
|
|
|
case cPawn::CROUCHED:
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[1] = 0x02;
|
|
|
|
break;
|
2011-12-27 21:10:05 -05:00
|
|
|
case cPawn::RIDING:
|
2011-10-03 14:41:19 -04:00
|
|
|
m_MetaData[1] = 0x04;
|
|
|
|
break;
|
2011-12-27 21:10:05 -05:00
|
|
|
case cPawn::SPRINTING:
|
|
|
|
m_MetaData[1] = 0x08;
|
|
|
|
break;
|
|
|
|
case cPawn::EATING:
|
|
|
|
case cPawn::BLOCKING:
|
|
|
|
m_MetaData[1] = 0x10;
|
|
|
|
break;
|
2011-10-03 14:41:19 -04:00
|
|
|
default:
|
|
|
|
m_MetaData[1] = 0x00;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
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);
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|