From e8366993ce3f1cc0c2c6cde1d133773d1f23c474 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 6 Aug 2012 20:10:16 +0000 Subject: A bit of cleanup and documentation around the UI window handling git-svn-id: http://mc-server.googlecode.com/svn/trunk@716 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWindow.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'source/cWindow.cpp') diff --git a/source/cWindow.cpp b/source/cWindow.cpp index fe029cfd9..f2c66420e 100644 --- a/source/cWindow.cpp +++ b/source/cWindow.cpp @@ -18,9 +18,9 @@ -cWindow::cWindow( cWindowOwner* a_Owner, bool a_bInventoryVisible ) - : m_WindowID( 0 ) - , m_WindowType( 0 ) +cWindow::cWindow( cWindowOwner* a_Owner, bool a_bInventoryVisible, cWindow::WindowType a_WindowType, int a_WindowID) + : m_WindowID( a_WindowID ) + , m_WindowType( a_WindowType ) , m_Owner( a_Owner ) , m_bInventoryVisible( a_bInventoryVisible ) , m_NumSlots( 0 ) @@ -28,8 +28,11 @@ cWindow::cWindow( cWindowOwner* a_Owner, bool a_bInventoryVisible ) , m_DraggingItem( 0 ) , m_IsDestroyed(false) { - LOGD("Created a window at %p", this); - if( !m_bInventoryVisible ) m_DraggingItem = new cItem(); + LOGD("Created a window at %p, type = %d, ID = %i", this, a_WindowType, a_WindowID); + if (!m_bInventoryVisible) + { + m_DraggingItem = new cItem(); + } } @@ -234,18 +237,18 @@ void cWindow::Open( cPlayer & a_Player ) void cWindow::Close( cPlayer & a_Player ) { //Checks wheather the player is still holding an item - if(m_DraggingItem && m_DraggingItem->m_ItemCount > 0) + if (m_DraggingItem && m_DraggingItem->m_ItemCount > 0) { - LOG("Player holds item! Dropping it..."); - a_Player.TossItem( true, m_DraggingItem->m_ItemCount ); + LOGD("Player holds item! Dropping it..."); + a_Player.TossItem(true, m_DraggingItem->m_ItemCount); } cPacket_WindowClose WindowClose; WindowClose.m_Close = (char)m_WindowID; cClientHandle * ClientHandle = a_Player.GetClientHandle(); - if ( ClientHandle != NULL) + if (ClientHandle != NULL) { - ClientHandle->Send( WindowClose ); + ClientHandle->Send(WindowClose); } { -- cgit v1.2.3