diff options
Diffstat (limited to '')
-rw-r--r-- | source/cCreativeInventory.cpp | 45 |
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; } + + + + |