summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-07-18 01:16:49 +0200
committerHowaner <franzi.moos@googlemail.com>2014-07-18 01:16:49 +0200
commit2e9aed793a5d4cde9fc93913ca0769fb1a913346 (patch)
tree2306f94d2c0a32dd5c4747ce1de267c0a056ebf4
parentItems should first added to the first slot, not the latest. (diff)
downloadcuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar.gz
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar.bz2
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar.lz
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar.xz
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.tar.zst
cuberite-2e9aed793a5d4cde9fc93913ca0769fb1a913346.zip
-rw-r--r--src/Inventory.cpp9
-rw-r--r--src/UI/SlotArea.cpp13
2 files changed, 13 insertions, 9 deletions
diff --git a/src/Inventory.cpp b/src/Inventory.cpp
index 38d3c886d..18154bafd 100644
--- a/src/Inventory.cpp
+++ b/src/Inventory.cpp
@@ -102,15 +102,6 @@ int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryT
{
cItem ToAdd(a_Item);
int res = 0;
- if (ItemCategory::IsArmor(a_Item.m_ItemType))
- {
- res = m_ArmorSlots.AddItem(ToAdd, a_AllowNewStacks);
- ToAdd.m_ItemCount -= res;
- if (ToAdd.m_ItemCount == 0)
- {
- return res;
- }
- }
res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1);
ToAdd.m_ItemCount = a_Item.m_ItemCount - res;
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 21b6ed0c8..f331c2fc2 100644
--- a/src/UI/SlotArea.cpp
+++ b/src/UI/SlotArea.cpp
@@ -1866,6 +1866,19 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C
{
ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots()));
+ if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory))
+ {
+ if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey))
+ {
+ DropClicked(a_Player, a_SlotNum, (a_ClickAction == caCtrlDropKey));
+ return;
+ }
+
+ // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it
+ SetSlot(a_SlotNum, a_Player, a_ClickedItem);
+ return;
+ }
+
bool bAsync = false;
if (GetSlot(a_SlotNum, a_Player) == NULL)
{