summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 10:04:58 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 10:04:58 +0200
commit530be5bd6603b4c59deb5f44ca96b1ee000acb02 (patch)
treeac2f80c0fa3615caa54603892320eb101e927530 /source
parentMonster classes don't use cPackets. Chat messages are sent / broadcast without cPackets. BlockEntities don't use cPackets. (diff)
downloadcuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar.gz
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar.bz2
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar.lz
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar.xz
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.tar.zst
cuberite-530be5bd6603b4c59deb5f44ca96b1ee000acb02.zip
Diffstat (limited to 'source')
-rw-r--r--source/cInventory.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/source/cInventory.cpp b/source/cInventory.cpp
index cd74cad41..58165ff09 100644
--- a/source/cInventory.cpp
+++ b/source/cInventory.cpp
@@ -10,10 +10,6 @@
#include <json/json.h>
-#include "packets/cPacket_WindowClick.h"
-#include "packets/cPacket_WholeInventory.h"
-#include "packets/cPacket_InventorySlot.h"
-
#include "items/Item.h"
@@ -299,22 +295,17 @@ void cInventory::SendWholeInventoryToAll(void)
-void cInventory::SendSlot( int a_SlotNum )
+void cInventory::SendSlot(int a_SlotNum)
{
cItem * Item = GetSlot(a_SlotNum);
if (Item != NULL)
{
if (Item->IsEmpty())
{
+ // Sanitize items that are not completely empty (ie. count == 0, but type != empty)
Item->Empty();
}
- cPacket_InventorySlot InventorySlot;
- InventorySlot.m_ItemCount = Item->m_ItemCount;
- InventorySlot.m_ItemID = (short) Item->m_ItemID;
- InventorySlot.m_ItemUses = (char) Item->m_ItemHealth;
- InventorySlot.m_SlotNum = (short) a_SlotNum;
- InventorySlot.m_WindowID = 0; // Inventory window ID
- m_Owner->GetClientHandle()->Send( InventorySlot );
+ m_Owner->GetClientHandle()->SendInventorySlot(0, a_SlotNum, *Item);
}
}