summaryrefslogtreecommitdiffstats
path: root/src/UI
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-07-26 16:46:07 +0200
committerMattes D <github@xoft.cz>2014-07-26 16:46:07 +0200
commit3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba (patch)
tree832b5e4ac6fb940a5effa310e858d7454dcf4f41 /src/UI
parentGit: Ignore AllFiles.lst (generated by cmake) (diff)
parentChange comment. (diff)
downloadcuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar.gz
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar.bz2
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar.lz
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar.xz
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.tar.zst
cuberite-3a6b3a16b8f4bdcc9468940428cf11f60e29c9ba.zip
Diffstat (limited to 'src/UI')
-rw-r--r--src/UI/SlotArea.cpp17
-rw-r--r--src/UI/SlotArea.h2
2 files changed, 16 insertions, 3 deletions
diff --git a/src/UI/SlotArea.cpp b/src/UI/SlotArea.cpp
index 21b6ed0c8..b5f84c24c 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()));
+ // 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))
+ {
+ DropClicked(a_Player, a_SlotNum, (a_ClickAction == caCtrlDropKey));
+ return;
+ }
+
+ SetSlot(a_SlotNum, a_Player, a_ClickedItem);
+ return;
+ }
+
bool bAsync = false;
if (GetSlot(a_SlotNum, a_Player) == NULL)
{
@@ -1913,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);
@@ -1932,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)
{
diff --git a/src/UI/SlotArea.h b/src/UI/SlotArea.h
index 7f37159b7..fa842bb81 100644
--- a/src/UI/SlotArea.h
+++ b/src/UI/SlotArea.h
@@ -161,7 +161,7 @@ public:
/** Called when a player clicks in the window. Parameters taken from the click packet. */
virtual void Clicked(cPlayer & a_Player, int a_SlotNum, eClickAction a_ClickAction, const cItem & a_ClickedItem) override;
- bool CanPlaceInSlot(int a_SlotNum, const cItem & a_Item);
+ static bool CanPlaceArmorInSlot(int a_SlotNum, const cItem & a_Item);
} ;