summaryrefslogtreecommitdiffstats
path: root/source/packets/cPacket_CreativeInventoryAction.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
commit2691e8daed826e944ca38f4787c77273edbf9404 (patch)
tree3f9fca349df2253c2c314abf2e0c22e8af7f9604 /source/packets/cPacket_CreativeInventoryAction.cpp
parentAdded Core files to the VC2008 project (so that they can be opened from the IDE there, nothing more) (diff)
downloadcuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.gz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.bz2
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.lz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.xz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.zst
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.zip
Diffstat (limited to 'source/packets/cPacket_CreativeInventoryAction.cpp')
-rw-r--r--source/packets/cPacket_CreativeInventoryAction.cpp32
1 files changed, 8 insertions, 24 deletions
diff --git a/source/packets/cPacket_CreativeInventoryAction.cpp b/source/packets/cPacket_CreativeInventoryAction.cpp
index a71585df3..85291da3e 100644
--- a/source/packets/cPacket_CreativeInventoryAction.cpp
+++ b/source/packets/cPacket_CreativeInventoryAction.cpp
@@ -10,11 +10,9 @@
cPacket_CreativeInventoryAction::cPacket_CreativeInventoryAction( const cPacket_CreativeInventoryAction & a_Copy )
{
- m_PacketID = E_CREATIVE_INVENTORY_ACTION;
- m_Slot = a_Copy.m_Slot;
- m_ItemID = a_Copy.m_ItemID;
- m_Quantity = a_Copy.m_Quantity;
- m_Damage = a_Copy.m_Damage;
+ m_PacketID = E_CREATIVE_INVENTORY_ACTION;
+ m_SlotNum = a_Copy.m_SlotNum;
+ m_ClickedItem = a_Copy.m_ClickedItem;
}
@@ -24,20 +22,15 @@ cPacket_CreativeInventoryAction::cPacket_CreativeInventoryAction( const cPacket_
int cPacket_CreativeInventoryAction::Parse(cByteBuffer & a_Buffer)
{
int TotalBytes = 0;
- HANDLE_PACKET_READ(ReadBEShort, m_Slot, TotalBytes);
+ HANDLE_PACKET_READ(ReadBEShort, m_SlotNum, TotalBytes);
- cPacket_ItemData Item;
+ cPacket_ItemData Item(m_ClickedItem);
int res = Item.Parse(a_Buffer);
if (res < 0)
{
return res;
}
TotalBytes += res;
-
- m_ItemID = Item.m_ItemID;
- m_Quantity = Item.m_ItemCount;
- m_Damage = Item.m_ItemUses;
-
return TotalBytes;
}
@@ -47,19 +40,10 @@ int cPacket_CreativeInventoryAction::Parse(cByteBuffer & a_Buffer)
void cPacket_CreativeInventoryAction::Serialize(AString & a_Data) const
{
- short ItemID = m_ItemID;
- ASSERT(ItemID >= -1); // Check validity of packets in debug runtime
- if (ItemID <= 0)
- {
- ItemID = -1;
- // Fix, to make sure no invalid values are sent.
- // WARNING: HERE ITS -1, BUT IN NAMED ENTITY SPAWN PACKET ITS 0 !!
- }
-
- AppendByte (a_Data, m_PacketID);
- AppendShort (a_Data, m_Slot);
+ AppendByte (a_Data, m_PacketID);
+ AppendShort(a_Data, m_SlotNum);
- cPacket_ItemData::AppendItem(a_Data, ItemID, m_Quantity, m_Damage);
+ cPacket_ItemData::AppendItem(a_Data, m_ClickedItem);
}