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_MultiBlock.h"
|
|
|
|
|
2012-01-29 14:28:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_MultiBlock::cPacket_MultiBlock( const cPacket_MultiBlock & a_Copy )
|
|
|
|
{
|
|
|
|
m_PacketID = E_MULTI_BLOCK;
|
|
|
|
m_ChunkX = a_Copy.m_ChunkX;
|
|
|
|
m_ChunkZ = a_Copy.m_ChunkZ;
|
|
|
|
m_NumBlocks = a_Copy.m_NumBlocks;
|
2012-03-01 20:22:06 -05:00
|
|
|
m_DataSize = a_Copy.m_DataSize;
|
|
|
|
m_Data = new sBlockChange[m_NumBlocks];
|
|
|
|
memcpy( m_Data, a_Copy.m_Data, sizeof(sBlockChange)*m_NumBlocks );
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
cPacket_MultiBlock::~cPacket_MultiBlock()
|
|
|
|
{
|
2012-03-01 20:22:06 -05:00
|
|
|
delete [] m_Data;
|
2011-10-03 14:41:19 -04:00
|
|
|
}
|
|
|
|
|
2012-02-07 15:49:52 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void cPacket_MultiBlock::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_ChunkX);
|
|
|
|
AppendInteger(a_Data, m_ChunkZ);
|
|
|
|
AppendShort (a_Data, m_NumBlocks);
|
|
|
|
|
2012-03-01 20:22:06 -05:00
|
|
|
AppendInteger(a_Data, m_DataSize);
|
2012-03-02 08:41:42 -05:00
|
|
|
for( int i = 0; i < m_NumBlocks; ++i )
|
2012-03-24 07:40:29 -04:00
|
|
|
{
|
2012-03-02 08:41:42 -05:00
|
|
|
AppendInteger(a_Data, m_Data[i].Data);
|
2012-03-24 07:40:29 -04:00
|
|
|
}
|
2012-02-07 15:49:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|