From 423f49d175d8db6283232bd8bdc106e26bdcff4d Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 16 Feb 2012 13:42:35 +0000 Subject: Chunk is now marked as dirty; saving only dirty chunks; rewritten load / save not to use cChunkPtr; set VC2008 project to level4 warnings; block entities are now loaded and saved properly git-svn-id: http://mc-server.googlecode.com/svn/trunk@273 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWindow.cpp | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) (limited to 'source/cWindow.cpp') 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 ); } + + + + -- cgit v1.2.3