summaryrefslogtreecommitdiffstats
path: root/source/cInventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/cInventory.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/cInventory.cpp b/source/cInventory.cpp
index 1f4405470..8750b5368 100644
--- a/source/cInventory.cpp
+++ b/source/cInventory.cpp
@@ -348,7 +348,7 @@ int cInventory::MoveItem(ENUM_ITEM_ID a_ItemType, short a_ItemDamage, int a_Coun
{
int MaxCount = ItemHandler(a_ItemType)->GetMaxStackSize();
ASSERT(m_Slots[i].m_ItemCount <= MaxCount);
- int NumToMove = std::min(a_Count, MaxCount);
+ int NumToMove = std::min(a_Count, MaxCount - m_Slots[i].m_ItemCount);
m_Slots[i].m_ItemCount += NumToMove;
m_Slots[i].m_ItemHealth = a_ItemDamage;
m_Slots[i].m_ItemID = a_ItemType;