summaryrefslogtreecommitdiffstats
path: root/source/cWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/cWindow.cpp')
-rw-r--r--source/cWindow.cpp45
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 );
}
+
+
+
+