summaryrefslogtreecommitdiffstats
path: root/source/packets/cPacket_WindowClick.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-07 21:49:52 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-02-07 21:49:52 +0100
commitb7d524423c23470cd11e720eeb48368c072838cb (patch)
treef1478e6d8e9dc68332f493595e1f9265c964e68c /source/packets/cPacket_WindowClick.cpp
parentcSocketThreads initial commit. Not yet tested and not yet integrated (diff)
downloadcuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.gz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.bz2
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.lz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.xz
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.tar.zst
cuberite-b7d524423c23470cd11e720eeb48368c072838cb.zip
Diffstat (limited to '')
-rw-r--r--source/packets/cPacket_WindowClick.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/source/packets/cPacket_WindowClick.cpp b/source/packets/cPacket_WindowClick.cpp
index 2df2108e1..0b2d18415 100644
--- a/source/packets/cPacket_WindowClick.cpp
+++ b/source/packets/cPacket_WindowClick.cpp
@@ -9,31 +9,35 @@
-bool cPacket_WindowClick::Parse(cSocket & a_Socket)
+int cPacket_WindowClick::Parse(const char * a_Data, int a_Size)
{
-// LOG("-----------INV66-----------");
- m_Socket = a_Socket;
+ int TotalBytes = 0;
+ HANDLE_PACKET_READ(ReadByte, m_WindowID, TotalBytes);
+ HANDLE_PACKET_READ(ReadShort, m_SlotNum, TotalBytes);
+ HANDLE_PACKET_READ(ReadByte, m_RightMouse, TotalBytes);
+ HANDLE_PACKET_READ(ReadShort, m_NumClicks, TotalBytes);
+ HANDLE_PACKET_READ(ReadBool, m_Bool, TotalBytes);
- if( !ReadByte(m_WindowID) ) return false;
- if( !ReadShort(m_SlotNum) ) return false;
- if( !ReadByte(m_RightMouse) ) return false;
- if( !ReadShort(m_NumClicks) ) return false;
- if( !ReadBool(m_Bool) ) return false;
-
-// LOG("WindowID : %i", m_Type );
-// LOG("FromSlot: %i", m_SlotNum );
-// LOG("Right/Le: %i", m_RightMouse );
-// LOG("NumClick: %i", m_NumClicks );
+ // LOG("WindowClick: WindowID: %i; FromSlot: %i; Right/Le: %i; NumClick: %i", m_Type, m_SlotNum, m_RightMouse, m_NumClicks );
cPacket_ItemData Item;
- Item.Parse(m_Socket);
+ int res = Item.Parse(a_Data + TotalBytes, a_Size - TotalBytes);
+ if (res < 0)
+ {
+ return res;
+ }
+ TotalBytes += res;
- m_ItemID = Item.m_ItemID;
+ m_ItemID = Item.m_ItemID;
m_ItemCount = Item.m_ItemCount;
- m_ItemUses = Item.m_ItemUses;
+ m_ItemUses = Item.m_ItemUses;
m_EnchantNums = Item.m_EnchantNums;
- return true;
-} \ No newline at end of file
+ return TotalBytes;
+}
+
+
+
+