Files
cuberite-2a/source/packets/cPacket_InventorySlot.cpp
T

34 lines
789 B
C++
Raw Normal View History

#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
2011-10-03 18:41:19 +00:00
#include "cPacket_InventorySlot.h"
2011-12-21 20:42:34 +00:00
#include "cPacket_WholeInventory.h"
#include "cPacket_ItemData.h"
2011-10-03 18:41:19 +00:00
2011-10-03 18:41:19 +00:00
bool cPacket_InventorySlot::Send(cSocket & a_Socket)
{
unsigned int TotalSize = c_Size;
2011-12-21 20:42:34 +00:00
cPacket_ItemData Item;
TotalSize += Item.GetSize(m_ItemID);
2011-10-03 18:41:19 +00:00
char* Message = new char[TotalSize];
unsigned int i = 0;
2011-12-21 20:42:34 +00:00
AppendByte ( (char)m_PacketID, Message, i );
2011-10-03 18:41:19 +00:00
AppendByte ( m_WindowID, Message, i );
AppendShort ( m_SlotNum, Message, i );
2011-12-21 20:42:34 +00:00
Item.AppendItem(Message, i, m_ItemID, m_ItemCount, m_ItemUses);
2011-10-03 18:41:19 +00:00
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
delete [] Message;
return RetVal;
}