summaryrefslogtreecommitdiffstats
path: root/src/ItemGrid.cpp
diff options
context:
space:
mode:
authorandrew <xdotftw@gmail.com>2014-02-20 14:37:15 +0100
committerandrew <xdotftw@gmail.com>2014-02-20 14:37:15 +0100
commit83d3a2eedf88a3a180b9dfc4c706838d7f99382a (patch)
treed96970727615c681efe3bf76793015cead438394 /src/ItemGrid.cpp
parentcMapDecorator: Implemented random rotations (diff)
parentAPIDump: Fixed cBlockArea:GetRelBlockType() return types. (diff)
downloadcuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.gz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.bz2
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.lz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.xz
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.tar.zst
cuberite-83d3a2eedf88a3a180b9dfc4c706838d7f99382a.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;
}