summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-12 23:01:22 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-02-12 23:01:22 +0100
commitf97ce3015171fcc6f6c5316810d19eb37c89c5f7 (patch)
tree9be0de9fb745d726242b0137a70665d88cb88ecb /src/ItemGrid.cpp
parentMade player jump reset less ambiguous (diff)
downloadcuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar.gz
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar.bz2
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar.lz
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar.xz
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.tar.zst
cuberite-f97ce3015171fcc6f6c5316810d19eb37c89c5f7.zip
Diffstat (limited to '')
-rw-r--r--src/ItemGrid.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ItemGrid.cpp b/src/ItemGrid.cpp
index e8b58695f..34a267bab 100644
--- a/src/ItemGrid.cpp
+++ b/src/ItemGrid.cpp
@@ -369,6 +369,13 @@ 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())
+ {
+ m_Slots[a_SlotNum].m_ItemCount = Handler->GetMaxStackSize();
+ }
+
TriggerListeners(a_SlotNum);
return m_Slots[a_SlotNum].m_ItemCount;
}