From bc466f07a454271d4845a7e8c7f0822541c5afbd Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 20 Sep 2012 13:25:54 +0000 Subject: Refactored windows. As described on the forum: http://forum.mc-server.org/showthread.php?tid=561 For now, only basic clicking works; shift-click not implemented yet. git-svn-id: http://mc-server.googlecode.com/svn/trunk@867 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cInventory.h | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'source/cInventory.h') diff --git a/source/cInventory.h b/source/cInventory.h index 96d744baf..bce485852 100644 --- a/source/cInventory.h +++ b/source/cInventory.h @@ -1,7 +1,7 @@ #pragma once -#include "cWindowOwner.h" +#include "cItem.h" @@ -12,7 +12,6 @@ namespace Json class Value; }; -class cItem; class cClientHandle; class cPlayer; @@ -21,10 +20,9 @@ class cPlayer; class cInventory //tolua_export - : public cWindowOwner { //tolua_export public: - cInventory(cPlayer* a_Owner); + cInventory(cPlayer & a_Owner); ~cInventory(); void Clear(); //tolua_export @@ -38,19 +36,17 @@ public: void SaveToJson(Json::Value & a_Value); bool LoadFromJson(Json::Value & a_Value); - void SendWholeInventory( cClientHandle* a_Client ); - void SendWholeInventoryToAll(void); + void SendWholeInventory(cClientHandle & a_Client); - cItem* GetSlot( int a_SlotNum ); //tolua_export - cItem* GetSlots() const { return m_Slots; } - cItem* GetFromHotBar( int a_SlotNum ); //tolua_export + cItem * GetSlot(int a_SlotNum ); //tolua_export + cItem * GetSlots(void) { return m_Slots; } + const cItem * GetSlots(void) const { return m_Slots; } + cItem * GetFromHotBar(int a_HotBarSlotNum); //tolua_export cItem & GetEquippedItem(void); //tolua_export const cItem & GetEquippedItem(void) const; - void SetEquippedSlot( int a_SlotNum ); //tolua_export - short GetEquippedSlot() { return m_EquippedSlot; } //tolua_export - - virtual void Clicked(short a_SlotNum, bool a_IsRightClick, bool a_IsShiftPressed, const cItem & a_HeldItem) = 0; + void SetEquippedSlot(int a_SlotNum); //tolua_export + short GetEquippedSlot(void) { return m_EquippedSlot; } //tolua_export void SendSlot( int a_SlotNum ); //tolua_export @@ -74,19 +70,17 @@ public: protected: bool AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode = 0 ); - cItem* m_Slots; - cItem* m_MainSlots; - cItem* m_CraftSlots; - cItem* m_ArmorSlots; - cItem* m_HotSlots; + cItem m_Slots[c_NumSlots]; + + cItem * m_MainSlots; + cItem * m_CraftSlots; + cItem * m_ArmorSlots; + cItem * m_HotSlots; - cItem* m_EquippedItem; + cItem * m_EquippedItem; short m_EquippedSlot; - cPlayer* m_Owner; - - // cWindowOwner override: - virtual void GetBlockPos(int & a_BlockX, int & a_BlockY, int & a_BlockZ) override {} // UNUSED for an inventory + cPlayer & m_Owner; }; //tolua_export -- cgit v1.2.3