diff options
Diffstat (limited to 'source/Item.h')
-rw-r--r-- | source/Item.h | 13 |
1 files changed, 11 insertions, 2 deletions
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 |