From 3ff57559e36d3254c64e334fbe3bdd47398fe16f Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Thu, 2 Dec 2021 00:31:10 +0100 Subject: ItemHandler initialisation is a constant expression (#5344) * Transition to non-pointer item handler * That is my destructor - I decide when I leave this world * I declare your destruction private and you final --- src/ItemGrid.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/ItemGrid.cpp') diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp index a4cf41a14..4ffd51b97 100644 --- a/src/ItemGrid.cpp +++ b/src/ItemGrid.cpp @@ -246,7 +246,7 @@ void cItemGrid::Clear(void) int cItemGrid::HowManyCanFit(const cItem & a_ItemStack, bool a_AllowNewStacks) { int NumLeft = a_ItemStack.m_ItemCount; - int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); + int MaxStack = a_ItemStack.GetMaxStackSize(); if (!m_Slots.IsStorageAllocated()) { @@ -491,10 +491,9 @@ int cItemGrid::ChangeSlotCount(int a_SlotNum, int a_AddToCount) m_Slots[a_SlotNum].m_ItemCount += a_AddToCount; - cItemHandler * Handler = cItemHandler::GetItemHandler(m_Slots[a_SlotNum].m_ItemType); - if (m_Slots[a_SlotNum].m_ItemCount > Handler->GetMaxStackSize()) + if (m_Slots[a_SlotNum].m_ItemCount > m_Slots[a_SlotNum].GetMaxStackSize()) { - m_Slots[a_SlotNum].m_ItemCount = Handler->GetMaxStackSize(); + m_Slots[a_SlotNum].m_ItemCount = m_Slots[a_SlotNum].GetMaxStackSize(); } TriggerListeners(a_SlotNum); -- cgit v1.2.3