summaryrefslogtreecommitdiffstats
path: root/src/Inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Inventory.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 6509dfe5d..2fdd1c25f 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -78,7 +78,7 @@ int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int
}
char NumLeft = a_ItemStack.m_ItemCount;
- int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize();
+ int MaxStack = a_ItemStack.GetMaxStackSize();
for (int i = a_BeginSlotNum; i <= a_EndSlotNum; i++)
{
const cItem & Slot = GetSlot(i);
@@ -260,8 +260,7 @@ int cInventory::ReplaceOneEquippedItem(const cItem & a_Item, bool a_TryOtherSlot
cItem ItemsToAdd = a_Item;
if (EquippedItem.IsEqual(ItemsToAdd))
{
- cItemHandler Handler(ItemsToAdd.m_ItemType);
- auto AmountToAdd = std::min(static_cast<char>(Handler.GetMaxStackSize() - EquippedItem.m_ItemCount), ItemsToAdd.m_ItemCount);
+ auto AmountToAdd = std::min(static_cast<char>(ItemsToAdd.GetMaxStackSize() - EquippedItem.m_ItemCount), ItemsToAdd.m_ItemCount);
EquippedItem.m_ItemCount += AmountToAdd;
SetEquippedItem(EquippedItem);
@@ -689,7 +688,7 @@ void cInventory::UpdateItems(void)
const cItem & Slot = GetEquippedItem();
if (!Slot.IsEmpty())
{
- ItemHandler(Slot.m_ItemType)->OnUpdate(m_Owner.GetWorld(), &m_Owner, Slot);
+ Slot.GetHandler().OnUpdate(m_Owner.GetWorld(), &m_Owner, Slot);
}
}