summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-18 23:51:36 +0200
committermadmaxoft <github@xoft.cz>2014-07-18 23:51:36 +0200
commit76b33970b05c6ee8c018198904f8054b23df44d7 (patch)
tree1edf71ddb36ffa03abf97518005186f462bfee11 /src/Inventory.cpp
parentMerge branch 'Entities' (diff)
parentDebuggers: Optimized and commented the /rmitem handler. (diff)
downloadcuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar.gz
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar.bz2
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar.lz
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar.xz
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.tar.zst
cuberite-76b33970b05c6ee8c018198904f8054b23df44d7.zip
Diffstat (limited to 'src/Inventory.cpp')
-rw-r--r--src/Inventory.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 38d3c886d..5f7c24b60 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -151,6 +151,24 @@ int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a
+int cInventory::RemoveItem(const cItem & a_ItemStack)
+{
+ int RemovedItems = m_HotbarSlots.RemoveItem(a_ItemStack);
+
+ if (RemovedItems < a_ItemStack.m_ItemCount)
+ {
+ cItem Temp(a_ItemStack);
+ Temp.m_ItemCount -= RemovedItems;
+ RemovedItems += m_InventorySlots.RemoveItem(Temp);
+ }
+
+ return RemovedItems;
+}
+
+
+
+
+
bool cInventory::RemoveOneEquippedItem(void)
{
if (m_HotbarSlots.GetSlot(m_EquippedSlotNum).IsEmpty())