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_SpawnMob.h"
|
2012-01-27 09:04:28 -05:00
|
|
|
#include "../Vector3i.h"
|
2011-10-03 14:41:19 -04:00
|
|
|
|
2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
cPacket_SpawnMob::~cPacket_SpawnMob()
|
|
|
|
{
|
|
|
|
if( m_MetaData ) delete [] m_MetaData;
|
|
|
|
delete m_Pos;
|
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_SpawnMob::cPacket_SpawnMob()
|
|
|
|
: m_UniqueID( 0 )
|
|
|
|
, m_Type( 0 )
|
|
|
|
, m_Pos( new Vector3i() )
|
2012-02-07 15:49:52 -05:00
|
|
|
, m_Yaw( 0 )
|
2011-10-03 14:41:19 -04:00
|
|
|
, m_Pitch( 0 )
|
|
|
|
, m_MetaDataSize( 0 )
|
|
|
|
, m_MetaData( 0 )
|
2012-03-10 14:30:06 -05:00
|
|
|
, m_HeadYaw(0)
|
2011-10-03 14:41:19 -04:00
|
|
|
{
|
|
|
|
m_PacketID = E_SPAWN_MOB;
|
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_SpawnMob::cPacket_SpawnMob( const cPacket_SpawnMob & a_Clone )
|
|
|
|
{
|
|
|
|
m_Pos = new Vector3i();
|
|
|
|
|
|
|
|
m_PacketID = E_SPAWN_MOB;
|
|
|
|
m_UniqueID = a_Clone.m_UniqueID;
|
2012-03-10 14:30:06 -05:00
|
|
|
m_Type = a_Clone.m_Type;
|
|
|
|
*m_Pos = *a_Clone.m_Pos;
|
|
|
|
m_Yaw = a_Clone.m_Yaw;
|
|
|
|
m_Pitch = a_Clone.m_Pitch;
|
|
|
|
m_HeadYaw = a_Clone.m_HeadYaw;
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
m_MetaDataSize = a_Clone.m_MetaDataSize;
|
|
|
|
m_MetaData = new char[m_MetaDataSize];
|
|
|
|
memcpy( m_MetaData, a_Clone.m_MetaData, sizeof( char ) * m_MetaDataSize );
|
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPacket_SpawnMob::Serialize(AString & a_Data) const
|
2011-10-03 14:41:19 -04:00
|
|
|
{
|
2012-02-07 15:49:52 -05:00
|
|
|
AppendByte (a_Data, m_PacketID);
|
|
|
|
AppendInteger (a_Data, m_UniqueID);
|
|
|
|
AppendByte (a_Data, m_Type);
|
|
|
|
AppendInteger (a_Data, m_Pos->x);
|
|
|
|
AppendInteger (a_Data, m_Pos->y);
|
|
|
|
AppendInteger (a_Data, m_Pos->z);
|
|
|
|
AppendByte (a_Data, m_Yaw);
|
|
|
|
AppendByte (a_Data, m_Pitch);
|
2012-03-10 14:30:06 -05:00
|
|
|
AppendByte (a_Data, m_HeadYaw);
|
2012-02-07 15:49:52 -05:00
|
|
|
AppendData (a_Data, m_MetaData, m_MetaDataSize);
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|