From 5c38a831bf0bda271a45f143700b3fea5e6ea7ee Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Thu, 13 Jun 2013 06:13:56 +0000 Subject: cItemGrid: Added IsSlotEmpty() functions git-svn-id: http://mc-server.googlecode.com/svn/trunk@1585 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/BlockEntities/ChestEntity.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'source/BlockEntities/ChestEntity.cpp') diff --git a/source/BlockEntities/ChestEntity.cpp b/source/BlockEntities/ChestEntity.cpp index cd2b15e2b..3e75d5100 100644 --- a/source/BlockEntities/ChestEntity.cpp +++ b/source/BlockEntities/ChestEntity.cpp @@ -101,15 +101,20 @@ void cChestEntity::SendTo(cClientHandle & a_Client) void cChestEntity::UsedBy(cPlayer * a_Player) { - if (GetWindow() == NULL) + // If the window is not created, open it anew: + cWindow * Window = GetWindow(); + if (Window == NULL) { OpenNewWindow(); + Window = GetWindow(); } - if (GetWindow()) + + // Open the window for the player: + if (Window != NULL) { - if( a_Player->GetWindow() != GetWindow() ) + if (a_Player->GetWindow() != Window) { - a_Player->OpenWindow( GetWindow() ); + a_Player->OpenWindow(Window); } } -- cgit v1.2.3