From f261a03c141399fdf2de958a7431dc48d98dd04e Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Sun, 28 May 2017 19:07:38 +0100 Subject: Double chest window fix (#3735) --- src/BlockEntities/ChestEntity.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/BlockEntities/ChestEntity.h') diff --git a/src/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h index 9a10cd9a5..dfd5ca0d0 100644 --- a/src/BlockEntities/ChestEntity.h +++ b/src/BlockEntities/ChestEntity.h @@ -39,9 +39,17 @@ public: virtual void SendTo(cClientHandle & a_Client) override; virtual bool UsedBy(cPlayer * a_Player) override; - /** Opens a new chest window for this chest. - Scans for neighbors to open a double chest window, if appropriate. */ - void OpenNewWindow(void); + /** Search horizontally adjacent blocks for neighbouring chests and links them together. */ + void ScanNeighbours(); + + /** Opens a new chest window where this is the primary chest and any neighbour is the secondary. */ + void OpenNewWindow(); + + /** Forces any players to close the owned window. */ + void DestroyWindow(); + + /** Returns true if the chest should not be accessible by players. */ + bool IsBlocked(); /** Gets the number of players who currently have this chest open */ int GetNumberOfPlayers(void) const { return m_NumActivePlayers; } @@ -54,6 +62,9 @@ private: /** Number of players who currently have this chest open */ int m_NumActivePlayers; + /** Neighbouring chest that links to form a double chest */ + cChestEntity * m_Neighbour; + /** cItemGrid::cListener overrides: */ virtual void OnSlotChanged(cItemGrid * a_Grid, int a_SlotNum) override { -- cgit v1.2.3