1
0

Rewritten all packets to use buffers instead of direct sockets, for future cSocketThreads compatibility.

Moved data sending from cPacket into cSocket

git-svn-id: http://mc-server.googlecode.com/svn/trunk@240 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-02-07 20:49:52 +00:00
parent 16feb0924e
commit b7d524423c
109 changed files with 1896 additions and 1305 deletions

View File

@@ -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;
}
return TotalBytes;
}