summaryrefslogtreecommitdiffstats
path: root/source/packets/cPacket_AddToInventory.cpp
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-21 21:42:34 +0100
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-12-21 21:42:34 +0100
commit02f05f749645d3ef211676e6745d3feda2cd0513 (patch)
tree2b4c08e1ff7eab1d69f1dad4a00ef2d4d4fbcd3c /source/packets/cPacket_AddToInventory.cpp
parentChanged chunk generation so any surface sand with air underneath it will turn into sandstone to prevent most sand cave-ins due to odd cave placement. (diff)
downloadcuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.gz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.bz2
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.lz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.xz
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.tar.zst
cuberite-02f05f749645d3ef211676e6745d3feda2cd0513.zip
Diffstat (limited to '')
-rw-r--r--source/packets/cPacket_AddToInventory.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/packets/cPacket_AddToInventory.cpp b/source/packets/cPacket_AddToInventory.cpp
index 5d3274229..0a9dad8c0 100644
--- a/source/packets/cPacket_AddToInventory.cpp
+++ b/source/packets/cPacket_AddToInventory.cpp
@@ -1,15 +1,22 @@
#include "cPacket_AddToInventory.h"
+#include "cPacket_WholeInventory.h"
+#include "cItem.h"
+#include "cPacket_ItemData.h"
bool cPacket_AddToInventory::Send( cSocket & a_Socket )
{
unsigned int TotalSize = c_Size;
+
+ cPacket_ItemData Item;
+
+ TotalSize += Item.GetSize(m_ItemType);
+
char* Message = new char[TotalSize];
unsigned int i = 0;
- AppendByte ( (char)m_PacketID, Message, i );
- AppendShort ( m_ItemType, Message, i );
- AppendByte ( m_Count, Message, i );
- AppendShort ( m_Life, Message, i );
+ AppendByte ( (char) m_PacketID, Message, i );
+
+ Item.AppendItem(Message, i, m_ItemType, m_Count, this->m_Life);
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
delete [] Message;