summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-07-18 23:11:59 +0200
committerHowaner <franzi.moos@googlemail.com>2014-07-18 23:11:59 +0200
commit51b91befbd26b630cd2cecaec081edd03edfb5f3 (patch)
tree7e34efa7eddbfc0041224b9bd15af415c099ab72 /src/Inventory.cpp
parentMonster fixes (diff)
downloadcuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar.gz
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar.bz2
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar.lz
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar.xz
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.tar.zst
cuberite-51b91befbd26b630cd2cecaec081edd03edfb5f3.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())