summaryrefslogtreecommitdiffstats
path: root/source/Protocol/Protocol125.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/Protocol/Protocol125.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 '')
-rw-r--r--source/Protocol/Protocol125.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/source/Protocol/Protocol125.cpp b/source/Protocol/Protocol125.cpp
index 4be4cb033..17def7c8a 100644
--- a/source/Protocol/Protocol125.cpp
+++ b/source/Protocol/Protocol125.cpp
@@ -1381,7 +1381,47 @@ int cProtocol125::ParseWindowClick(void)
{
return res;
}
- m_Client->HandleWindowClick(WindowID, SlotNum, IsRightClick, IsShiftPressed, HeldItem);
+
+ // Convert IsShiftPressed, IsRightClick, SlotNum and HeldItem into eClickAction used in the newer protocols:
+ eClickAction Action;
+ if (IsRightClick)
+ {
+ if (IsShiftPressed)
+ {
+ Action = caShiftRightClick;
+ }
+ else
+ {
+ if (SlotNum == -999)
+ {
+ Action = (HeldItem.IsEmpty()) ? caRightClickOutsideHoldNothing : caRightClickOutside;
+ }
+ else
+ {
+ Action = caRightClick;
+ }
+ }
+ }
+ else
+ {
+ // IsLeftClick
+ if (IsShiftPressed)
+ {
+ Action = caShiftLeftClick;
+ }
+ else
+ {
+ if (SlotNum == -999)
+ {
+ Action = (HeldItem.IsEmpty()) ? caLeftClickOutsideHoldNothing : caRightClickOutside;
+ }
+ else
+ {
+ Action = caLeftClick;
+ }
+ }
+ }
+ m_Client->HandleWindowClick(WindowID, SlotNum, Action, HeldItem);
return PARSE_OK;
}