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_AddToInventory.h"
|
2011-12-21 15:42:34 -05:00
|
|
|
#include "cPacket_WholeInventory.h"
|
2012-01-27 09:04:28 -05:00
|
|
|
#include "../cItem.h"
|
2011-12-21 15:42:34 -05:00
|
|
|
#include "cPacket_ItemData.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
|
|
|
bool cPacket_AddToInventory::Send( cSocket & a_Socket )
|
|
|
|
{
|
|
|
|
unsigned int TotalSize = c_Size;
|
2011-12-21 15:42:34 -05:00
|
|
|
|
|
|
|
cPacket_ItemData Item;
|
|
|
|
|
2011-12-22 11:30:40 -05:00
|
|
|
TotalSize += Item.GetSize((short) m_ItemType);
|
2011-12-21 15:42:34 -05:00
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
char* Message = new char[TotalSize];
|
|
|
|
|
|
|
|
unsigned int i = 0;
|
2011-12-21 15:42:34 -05:00
|
|
|
AppendByte ( (char) m_PacketID, Message, i );
|
|
|
|
|
2011-12-22 11:30:40 -05:00
|
|
|
Item.AppendItem(Message, i, (short) m_ItemType, m_Count, this->m_Life);
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
|
|
|
delete [] Message;
|
|
|
|
return RetVal;
|
|
|
|
}
|