summaryrefslogtreecommitdiffstats
path: root/source/BlockEntities
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-13 08:13:56 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-06-13 08:13:56 +0200
commit5c38a831bf0bda271a45f143700b3fea5e6ea7ee (patch)
tree462a6e2d32fb132940a27ae5d782530b29f0a9c5 /source/BlockEntities
parentChestEntity: fixed bindings (diff)
downloadcuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar.gz
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar.bz2
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar.lz
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar.xz
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.tar.zst
cuberite-5c38a831bf0bda271a45f143700b3fea5e6ea7ee.zip
Diffstat (limited to '')
-rw-r--r--source/BlockEntities/ChestEntity.cpp13
-rw-r--r--source/BlockEntities/ChestEntity.h8
2 files changed, 13 insertions, 8 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);
}
}
diff --git a/source/BlockEntities/ChestEntity.h b/source/BlockEntities/ChestEntity.h
index 86cb618d5..c6676894f 100644
--- a/source/BlockEntities/ChestEntity.h
+++ b/source/BlockEntities/ChestEntity.h
@@ -47,14 +47,14 @@ public:
static const char * GetClassStatic(void) { return "cChestEntity"; }
- bool LoadFromJson(const Json::Value& a_Value);
+ bool LoadFromJson(const Json::Value & a_Value);
// cBlockEntity overrides:
- virtual void SaveToJson(Json::Value & a_Value ) override;
+ virtual void SaveToJson(Json::Value & a_Value) override;
virtual void SendTo(cClientHandle & a_Client) override;
- virtual void UsedBy(cPlayer * a_Player);
+ virtual void UsedBy(cPlayer * a_Player) override;
- /// Opens a new chest window for this chests. Scans for neighbors to open a double chest window, if appropriate.
+ /// Opens a new chest window for this chest. Scans for neighbors to open a double chest window, if appropriate.
void OpenNewWindow(void);
} ; // tolua_export