diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 14:42:35 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-02-16 14:42:35 +0100 |
commit | 423f49d175d8db6283232bd8bdc106e26bdcff4d (patch) | |
tree | 5c5cc58d1061c91d2cb39021853ce72ab59839ae /source/cWindow.cpp | |
parent | Chunks are properly saved before being unloaded now (diff) | |
download | cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.gz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.bz2 cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.lz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.xz cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.tar.zst cuberite-423f49d175d8db6283232bd8bdc106e26bdcff4d.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cWindow.cpp | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/source/cWindow.cpp b/source/cWindow.cpp index 4710ad8a4..1914daa40 100644 --- a/source/cWindow.cpp +++ b/source/cWindow.cpp @@ -30,6 +30,10 @@ cWindow::cWindow( cWindowOwner* a_Owner, bool a_bInventoryVisible ) if( !m_bInventoryVisible ) m_DraggingItem = new cItem();
}
+
+
+
+
cWindow::~cWindow()
{
if( !m_bInventoryVisible && m_DraggingItem )
@@ -39,6 +43,10 @@ cWindow::~cWindow() }
}
+
+
+
+
cItem* cWindow::GetSlot( int a_Slot )
{
if(a_Slot > -1 && a_Slot < m_NumSlots)
@@ -48,6 +56,10 @@ cItem* cWindow::GetSlot( int a_Slot ) return 0;
}
+
+
+
+
cItem* cWindow::GetDraggingItem( cPlayer * a_Player /* = 0 */ )
{
if( m_bInventoryVisible && a_Player )
@@ -61,9 +73,12 @@ cItem* cWindow::GetDraggingItem( cPlayer * a_Player /* = 0 */ ) return m_DraggingItem;
}
+
+
+
+
void cWindow::Clicked( cPacket_WindowClick* a_ClickPacket, cPlayer & a_Player )
{
- //LOG("cWindow click");
if( a_ClickPacket->m_WindowID != m_WindowID )
{
LOG("WRONG WINDOW ID!");
@@ -183,6 +198,10 @@ void cWindow::Clicked( cPacket_WindowClick* a_ClickPacket, cPlayer & a_Player ) if( m_DraggingItem ) LOG("Dragging: %i", m_DraggingItem->m_ItemCount );
}
+
+
+
+
void cWindow::Open( cPlayer & a_Player )
{
// If player is already in OpenedBy remove player first
@@ -198,6 +217,10 @@ void cWindow::Open( cPlayer & a_Player ) a_Player.GetClientHandle()->Send( WindowOpen );
}
+
+
+
+
void cWindow::Close( cPlayer & a_Player )
{
//Checks wheather the player is still holding an item
@@ -205,11 +228,9 @@ void cWindow::Close( cPlayer & a_Player ) {
LOG("Player holds item! Dropping it...");
a_Player.TossItem( true, m_DraggingItem->m_ItemCount );
-
}
-
- cPacket_WindowClose WindowClose;
+ cPacket_WindowClose WindowClose;
WindowClose.m_Close = (char)m_WindowID;
cClientHandle* ClientHandle = a_Player.GetClientHandle();
if( ClientHandle ) ClientHandle->Send( WindowClose );
@@ -219,9 +240,11 @@ void cWindow::Close( cPlayer & a_Player ) {
Destroy();
}
+}
+
+
-}
void cWindow::OwnerDestroyed()
{
@@ -233,6 +256,10 @@ void cWindow::OwnerDestroyed() (*m_OpenedBy.begin() )->CloseWindow((char)GetWindowType());
}
+
+
+
+
void cWindow::Destroy()
{
LOG("DESTROY WINDOW");
@@ -244,8 +271,16 @@ void cWindow::Destroy() delete this;
}
+
+
+
+
void cWindow::SendWholeWindow( cClientHandle* a_Client )
{
cPacket_WholeInventory Inventory( this );
a_Client->Send( Inventory );
}
+
+
+
+
|