diff options
author | madmaxoft <github@xoft.cz> | 2014-07-18 23:51:36 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-07-18 23:51:36 +0200 |
commit | 76b33970b05c6ee8c018198904f8054b23df44d7 (patch) | |
tree | 1edf71ddb36ffa03abf97518005186f462bfee11 /src/Inventory.cpp | |
parent | Merge branch 'Entities' (diff) | |
parent | Debuggers: Optimized and commented the /rmitem handler. (diff) | |
download | cuberite-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.cpp | 18 |
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()) |