diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-16 22:41:08 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-01-16 22:41:08 +0100 |
commit | 590a8c45c559e9b2f58b267ae3415496e4cf9cd9 (patch) | |
tree | 06b61e2cc348e872da856fd36b11e19eb8557768 /src/UI/SlotArea.cpp | |
parent | Fixed #535 (diff) | |
download | cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar.gz cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar.bz2 cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar.lz cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar.xz cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.tar.zst cuberite-590a8c45c559e9b2f58b267ae3415496e4cf9cd9.zip |
Diffstat (limited to 'src/UI/SlotArea.cpp')
-rw-r--r-- | src/UI/SlotArea.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index bcbb06054..c8653a1e5 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -85,11 +85,11 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA { if (DraggingItem.m_ItemType <= 0) // Empty-handed? { + DraggingItem = Slot.CopyOne(); // Obtain copy of slot to preserve lore, enchantments, etc. + DraggingItem.m_ItemCount = (char)(((float)Slot.m_ItemCount) / 2.f + 0.5f); Slot.m_ItemCount -= DraggingItem.m_ItemCount; - DraggingItem.CustomCopy(Slot, true, false, true, true, true, true); - if (Slot.m_ItemCount <= 0) { Slot.Empty(); @@ -101,10 +101,13 @@ void cSlotArea::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickA cItemHandler * Handler = ItemHandler(Slot.m_ItemType); if ((DraggingItem.m_ItemCount > 0) && (Slot.m_ItemCount < Handler->GetMaxStackSize())) { - Slot.m_ItemCount++; - DraggingItem.m_ItemCount--; + char OldSlotCount = Slot.m_ItemCount; - Slot.CustomCopy(DraggingItem, true, false, true, true, true, true); + Slot = DraggingItem.CopyOne(); // See above + OldSlotCount++; + Slot.m_ItemCount = OldSlotCount; + + DraggingItem.m_ItemCount--; } if (DraggingItem.m_ItemCount <= 0) { |