From dc878898f36473c4df54457d2738562df4dec908 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 10 Apr 2013 21:40:30 +0000 Subject: Dispensers rewritten to use ItemGrid git-svn-id: http://mc-server.googlecode.com/svn/trunk@1383 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/DispenserEntity.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'source/DispenserEntity.h') diff --git a/source/DispenserEntity.h b/source/DispenserEntity.h index 9d27c59c4..ad755c7db 100644 --- a/source/DispenserEntity.h +++ b/source/DispenserEntity.h @@ -3,7 +3,7 @@ #include "BlockEntity.h" #include "UI/WindowOwner.h" -#include "Item.h" +#include "ItemGrid.h" @@ -28,7 +28,7 @@ class cDispenserEntity : public: cDispenserEntity(int a_X, int a_Y, int a_Z, cWorld * a_World); virtual ~cDispenserEntity(); - virtual void Destroy(); + virtual void Destroy(void); bool LoadFromJson(const Json::Value & a_Value); @@ -38,17 +38,21 @@ public: virtual bool Tick(float a_Dt) override; virtual void UsedBy(cPlayer * a_Player) override; - const cItem * GetSlot(int i) const { return &(m_Items[i]); } + const cItem & GetSlot(int a_SlotNum) const { return m_Contents.GetSlot(a_SlotNum); } - void SetSlot(int a_Slot, const cItem & a_Item); + void SetSlot(int a_SlotNum, const cItem & a_Item) { m_Contents.SetSlot(a_SlotNum, a_Item); } - void Activate(); + /// Sets the dispenser to dispense an item in the next tick + void Activate(void); + + const cItemGrid & GetContents(void) const { return m_Contents; } + cItemGrid & GetContents(void) { return m_Contents; } private: - cItem * m_Items; - bool m_CanDispense; + cItemGrid m_Contents; + bool m_ShouldDispense; ///< If true, the dispenser will dispense an item in the next tick - void Dispense(); + void Dispense(void); }; -- cgit v1.2.3