summaryrefslogtreecommitdiffstats
path: root/source/cCreativeInventory.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 11:56:28 +0200
commit2691e8daed826e944ca38f4787c77273edbf9404 (patch)
tree3f9fca349df2253c2c314abf2e0c22e8af7f9604 /source/cCreativeInventory.cpp
parentAdded Core files to the VC2008 project (so that they can be opened from the IDE there, nothing more) (diff)
downloadcuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.gz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.bz2
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.lz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.xz
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.tar.zst
cuberite-2691e8daed826e944ca38f4787c77273edbf9404.zip
Diffstat (limited to 'source/cCreativeInventory.cpp')
-rw-r--r--source/cCreativeInventory.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/source/cCreativeInventory.cpp b/source/cCreativeInventory.cpp
index 77b9107b7..f1a1ae89c 100644
--- a/source/cCreativeInventory.cpp
+++ b/source/cCreativeInventory.cpp
@@ -14,37 +14,50 @@
#include "packets/cPacket_WholeInventory.h"
#include "packets/cPacket_InventorySlot.h"
-cCreativeInventory::~cCreativeInventory()
-{
-}
-cCreativeInventory::cCreativeInventory(cPlayer* a_Owner)
+
+
+
+cCreativeInventory::cCreativeInventory(cPlayer * a_Owner)
: cInventory(a_Owner)
{
}
-void cCreativeInventory::Clicked( cPacket* a_ClickPacket )
+
+
+
+
+cCreativeInventory::~cCreativeInventory()
{
- cPacket_CreativeInventoryAction* Packet = reinterpret_cast<cPacket_CreativeInventoryAction *>(a_ClickPacket);
- short Slot = Packet->m_Slot;
- if (Slot == -1)
+}
+
+
+
+
+
+void cCreativeInventory::Clicked(
+ short a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed,
+ const cItem & a_HeldItem
+)
+{
+ if (a_SlotNum == -1)
{
// object thrown out
- m_Owner->TossItem(false, Packet->m_Quantity, Packet->m_ItemID, Packet->m_Damage);
+ m_Owner->TossItem(false, a_HeldItem.m_ItemCount, a_HeldItem.m_ItemType, a_HeldItem.m_ItemDamage);
return;
}
- if ((Slot < c_HotOffset) || (Slot >= c_NumSlots))
+ if ((a_SlotNum < c_HotOffset) || (a_SlotNum >= c_NumSlots))
{
- LOG("%s: Invalid slot (%d) in CreativeInventoryAction packet. Ignoring...", m_Owner->GetName().c_str(), Slot);
+ LOG("%s: Invalid slot (%d) in cCreativeInventory::Clicked(). Ignoring...", m_Owner->GetName().c_str(), a_SlotNum);
return;
}
- cItem * SlotItem = &(this->m_Slots[Slot]);
-
- SlotItem->m_ItemID = (ENUM_ITEM_ID) Packet->m_ItemID;
- SlotItem->m_ItemHealth = Packet->m_Damage;
- SlotItem->m_ItemCount = Packet->m_Quantity;
+ m_Slots[a_SlotNum] = a_HeldItem;
}
+
+
+
+