summaryrefslogtreecommitdiffstats
path: root/src/UI/SlotArea.cpp
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-04-14 22:05:04 +0200
committerdaniel0916 <theschokolps@gmail.com>2014-04-14 22:05:04 +0200
commitb5401ec03ad74782129e6a68eac3e9c0ccb573e2 (patch)
treeedc3028cdb2947559e3dcf069c80e9d5db2d315a /src/UI/SlotArea.cpp
parentRemoved Debug Message (diff)
downloadcuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar.gz
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar.bz2
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar.lz
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar.xz
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.tar.zst
cuberite-b5401ec03ad74782129e6a68eac3e9c0ccb573e2.zip
Diffstat (limited to '')
-rw-r--r--src/UI/SlotArea.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index eb528d7ca..9ea2e0021 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -135,6 +135,12 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA
cItem tmp(DraggingItem);
DraggingItem = Slot;
Slot = tmp;
+ int ItemPlaceCount = GetItemPlaceCount(Slot);
+ if (Slot.m_ItemCount > ItemPlaceCount)
+ {
+ DraggingItem.m_ItemCount += Slot.m_ItemCount - ItemPlaceCount;
+ Slot.m_ItemCount = ItemPlaceCount;
+ }
}
else
{
@@ -147,6 +153,13 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA
FreeSlots = 0;
}
int Filling = (FreeSlots > DraggingItem.m_ItemCount) ? DraggingItem.m_ItemCount : FreeSlots;
+
+ int ItemPlaceCount = GetItemPlaceCount(DraggingItem);
+ if (Filling > ItemPlaceCount)
+ {
+ Filling = ItemPlaceCount;
+ }
+
Slot.m_ItemCount += (char)Filling;
DraggingItem.m_ItemCount -= (char)Filling;
if (DraggingItem.m_ItemCount <= 0)
@@ -315,6 +328,16 @@ bool cSlotArea::CollectItemsToHand(cItem & a_Dragging, cPlayer & a_Player, bool
+int cSlotArea::GetItemPlaceCount(cItem & a_Item)
+{
+ cItemHandler * Handler = ItemHandler(a_Item.m_ItemType);
+ return Handler->GetMaxStackSize();
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaChest:
@@ -718,6 +741,15 @@ void cSlotAreaEnchanting::ShiftClickedSlot(cPlayer & a_Player)
+int cSlotAreaEnchanting::GetItemPlaceCount(cItem & a_Item)
+{
+ return 1;
+}
+
+
+
+
+
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// cSlotAreaEnderChest: