From 9684f90f8361fb314a60a387dc9ecf9bc4c3062a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 30 May 2013 19:34:09 +0000 Subject: LuaWindow: Initial code, the window can be opened, but not much manipulated git-svn-id: http://mc-server.googlecode.com/svn/trunk@1532 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/UI/Window.h | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'source/UI/Window.h') diff --git a/source/UI/Window.h b/source/UI/Window.h index c31ed8a4d..1f2495a46 100644 --- a/source/UI/Window.h +++ b/source/UI/Window.h @@ -68,7 +68,7 @@ public: cWindow(WindowType a_WindowType, const AString & a_WindowTitle); virtual ~cWindow(); - char GetWindowID(void) const { return m_WindowID; } + char GetWindowID(void) const { return m_WindowID; } // tolua_export int GetWindowType(void) const { return m_WindowType; } // tolua_export cWindowOwner * GetOwner(void) { return m_Owner; } @@ -84,6 +84,15 @@ public: /// Sets the item to the specified slot for the specified player void SetSlot(cPlayer & a_Player, int a_SlotNum, const cItem & a_Item); + /// Returns true if the specified slot is in the Player Main Inventory slotarea + bool IsSlotInPlayerMainInventory(int a_SlotNum) const; + + /// Returns true if the specified slot is in the Player Hotbar slotarea + bool IsSlotInPlayerHotbar(int a_SlotNum) const; + + /// Returns true if the specified slot is in the Player Main Inventory or Hotbar slotareas. Note that returns false for Armor. + bool IsSlotInPlayerInventory(int a_SlotNum) const; + // tolua_end /// Fills a_Slots with the slots read from m_SlotAreas[], for the specified player @@ -144,7 +153,8 @@ protected: static char m_WindowIDCounter; - void Destroy(void); + /// Sets the internal flag as "destroyed"; notifies the owner that the window is destroying + virtual void Destroy(void); /** Returns the correct slot area for the specified window-global SlotNum Also returns the area-local SlotNum corresponding to the GlobalSlotNum @@ -173,7 +183,7 @@ protected: /// Distributes a_NumToEachSlot items into the slots specified in a_SlotNums; returns the total number of items distributed int DistributeItemToSlots(cPlayer & a_Player, const cItem & a_Item, int a_NumToEachSlot, const cSlotNums & a_SlotNums); -} ; +} ; // tolua_export @@ -244,24 +254,3 @@ protected: - -// tolua_begin - -/// A window that has been created by a Lua plugin and is handled entirely by that plugin -class cLuaWindow : - public cWindow -{ -public: - /// Create a window of the specified type, with a slot grid of a_SlotsX * a_SlotsY size - cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_SlotsY, const AString & a_Title); - - // tolua_end - -protected: - /// Contents of the non-inventory part - cItemGrid m_Contents; -} ; - - - - -- cgit v1.2.3