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/Item.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source/Item.h') diff --git a/source/Item.h b/source/Item.h index 194b6bff6..d2cbd6053 100644 --- a/source/Item.h +++ b/source/Item.h @@ -27,13 +27,15 @@ public: } } - void Empty() + + void Empty(void) { m_ItemType = E_ITEM_EMPTY; m_ItemCount = 0; m_ItemDamage = 0; } + void Clear(void) { m_ItemType = E_ITEM_EMPTY; @@ -41,21 +43,28 @@ public: m_ItemDamage = 0; } + bool IsEmpty(void) const { - return (m_ItemType <= 0 || m_ItemCount <= 0); + return ((m_ItemType <= 0) || (m_ItemCount <= 0)); } + bool IsEqual(const cItem & a_Item) const { return (IsSameType(a_Item) && (m_ItemDamage == a_Item.m_ItemDamage)); } + bool IsSameType(const cItem & a_Item) const { return (m_ItemType == a_Item.m_ItemType) || (IsEmpty() && a_Item.IsEmpty()); } + + /// Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items + cItem CopyOne(void) const; + // TODO Sorry for writing the functions in the header. But somehow it doesn´t worked when I put them into the cpp File :s inline int GetMaxDuration(void) const -- cgit v1.2.3