1
0

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
This commit is contained in:
madmaxoft@gmail.com
2012-02-16 13:42:35 +00:00
parent 1c4122313f
commit 423f49d175
28 changed files with 980 additions and 157 deletions

View File

@@ -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,10 +240,12 @@ void cWindow::Close( cPlayer & a_Player )
{
Destroy();
}
}
void cWindow::OwnerDestroyed()
{
m_Owner = 0;
@@ -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 );
}