From 2e9aed793a5d4cde9fc93913ca0769fb1a913346 Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 01:16:49 +0200 Subject: Fixed the armor slot in creative mode. Also removed that armor get directly to the armor slot. It is extremely buggy and unnecessary. --- src/UI/SlotArea.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/UI/SlotArea.cpp') 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) { -- cgit v1.2.3 From e32b0ce4fa1e81c48a5036bc4c43112fda7ffada Mon Sep 17 00:00:00 2001 From: Howaner Date: Fri, 18 Jul 2014 16:38:59 +0200 Subject: Moved comment. --- src/UI/SlotArea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/UI/SlotArea.cpp') diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index f331c2fc2..6f4f65ca3 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1866,6 +1866,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C { ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); + // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory)) { if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey)) @@ -1874,7 +1875,6 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C 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; } -- cgit v1.2.3 From 897d68dc35620f0e6c33fe4a6083a76ab43a9a57 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sun, 20 Jul 2014 01:22:58 +0200 Subject: Add armor items directly to the armor slots. --- src/UI/SlotArea.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/UI/SlotArea.cpp') diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 6f4f65ca3..e9b1ef8e0 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1926,7 +1926,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C return; } - if (DraggingItem.IsEmpty() || CanPlaceInSlot(a_SlotNum, DraggingItem)) + if (DraggingItem.IsEmpty() || CanPlaceArmorInSlot(a_SlotNum, DraggingItem)) { // Swap contents cItem tmp(DraggingItem); @@ -1945,7 +1945,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C -bool cSlotAreaArmor::CanPlaceInSlot(int a_SlotNum, const cItem & a_Item) +bool cSlotAreaArmor::CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item) { switch (a_SlotNum) { -- cgit v1.2.3 From 6e2025d12544e33c379f0d03ab875faad08c7330 Mon Sep 17 00:00:00 2001 From: Howaner Date: Sat, 26 Jul 2014 13:29:25 +0200 Subject: Change comment. --- src/UI/SlotArea.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/UI/SlotArea.cpp') diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index e9b1ef8e0..b5f84c24c 100644 --- a/src/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp @@ -1866,7 +1866,7 @@ void cSlotAreaArmor::Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_C { ASSERT((a_SlotNum >= 0) && (a_SlotNum < GetNumSlots())); - // Creative inventory must treat a_ClickedItem as a DraggedItem instead, replacing the inventory slot with it + // When the player is in creative mode, the client sends the new item as a_ClickedItem, not the current item in the slot. if (a_Player.IsGameModeCreative() && (m_ParentWindow.GetWindowType() == cWindow::wtInventory)) { if ((a_ClickAction == caDropKey) || (a_ClickAction == caCtrlDropKey)) -- cgit v1.2.3