summaryrefslogtreecommitdiffstats
path: root/source/UI/Window.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-08 11:45:07 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-08 11:45:07 +0200
commit7cbf36bf17df70d325d03e4cd40859ac31b4c2e2 (patch)
tree09675adda6e35bab168cecb497849a870dfb4956 /source/UI/Window.cpp
parentPlease keep the lists alpha-sorted (diff)
downloadcuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.gz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.bz2
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.lz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.xz
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.tar.zst
cuberite-7cbf36bf17df70d325d03e4cd40859ac31b4c2e2.zip
Diffstat (limited to 'source/UI/Window.cpp')
-rw-r--r--source/UI/Window.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/UI/Window.cpp b/source/UI/Window.cpp
index 12c3e7350..bb80a7ce7 100644
--- a/source/UI/Window.cpp
+++ b/source/UI/Window.cpp
@@ -96,7 +96,7 @@ void cWindow::GetSlots(cPlayer & a_Player, cItems & a_Slots) const
void cWindow::Clicked(
cPlayer & a_Player,
- int a_WindowID, short a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed,
+ int a_WindowID, short a_SlotNum, eClickAction a_ClickAction,
const cItem & a_ClickedItem
)
{
@@ -106,16 +106,31 @@ void cWindow::Clicked(
return;
}
- if (a_SlotNum < 0) // Outside window click
+ switch (a_ClickAction)
{
- if (a_IsRightClick)
+ case caRightClickOutside:
{
+ // Toss one of the dragged items:
a_Player.TossItem(true);
+ return;
}
- else
+ case caLeftClickOutside:
{
+ // Toss all dragged items:
a_Player.TossItem(true, a_Player.GetDraggingItem().m_ItemCount);
+ return;
+ }
+ case caLeftClickOutsideHoldNothing:
+ case caRightClickOutsideHoldNothing:
+ {
+ // Nothing needed
+ return;
}
+ }
+
+ if (a_SlotNum < 0)
+ {
+ // TODO: Other click actions with irrelevant slot number (FS #371)
return;
}
@@ -125,7 +140,7 @@ void cWindow::Clicked(
{
if (LocalSlotNum < (*itr)->GetNumSlots())
{
- (*itr)->Clicked(a_Player, LocalSlotNum, a_IsRightClick, a_IsShiftPressed, a_ClickedItem);
+ (*itr)->Clicked(a_Player, LocalSlotNum, a_ClickAction, a_ClickedItem);
return;
}
LocalSlotNum -= (*itr)->GetNumSlots();