summaryrefslogtreecommitdiffstats
path: root/source/BlockEntities/ChestEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/BlockEntities/ChestEntity.cpp')
-rw-r--r--source/BlockEntities/ChestEntity.cpp13
1 files changed, 9 insertions, 4 deletions
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);
}
}