diff options
Diffstat (limited to '')
-rw-r--r-- | src/Inventory.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp index 42c243f17..6509dfe5d 100644 --- a/src/Inventory.cpp +++ b/src/Inventory.cpp @@ -105,6 +105,8 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks) { + m_Owner.AddKnownItem(a_Item); + cItem ToAdd(a_Item); int res = 0; @@ -207,6 +209,26 @@ int cInventory::RemoveItem(const cItem & a_ItemStack) +cItem * cInventory::FindItem(const cItem & a_RecipeItem) +{ + cItem * Item = m_ShieldSlots.FindItem(a_RecipeItem); + if (Item != nullptr) + { + return Item; + } + Item = m_HotbarSlots.FindItem(a_RecipeItem); + if (Item != nullptr) + { + return Item; + } + + return m_InventorySlots.FindItem(a_RecipeItem); +} + + + + + bool cInventory::RemoveOneEquippedItem(void) { if (m_HotbarSlots.GetSlot(m_EquippedSlotNum).IsEmpty()) @@ -863,7 +885,3 @@ void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) SendSlot(Base + a_SlotNum); } - - - - |