summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-02-15 15:06:23 +0100
committerMattes D <github@xoft.cz>2014-02-15 15:06:23 +0100
commit48eafee823cb979ded833b5311c0f5c37a8ca0f2 (patch)
treefad70a53bd337fa152f661e32422da5b9699096e /src/ItemGrid.cpp
parentMerge pull request #677 from mc-server/BroadcastParticleEffect (diff)
parentFixed typographical error (diff)
downloadcuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar.gz
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar.bz2
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar.lz
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar.xz
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.tar.zst
cuberite-48eafee823cb979ded833b5311c0f5c37a8ca0f2.zip
Diffstat (limited to 'src/ItemGrid.cpp')
-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;
}