diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-04-10 23:40:30 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-04-10 23:40:30 +0200 |
commit | dc878898f36473c4df54457d2738562df4dec908 (patch) | |
tree | 99e4daa3c37c8abe327605d61dd0081acb577d34 /source/Item.h | |
parent | Fixed gcc build (diff) | |
download | cuberite-dc878898f36473c4df54457d2738562df4dec908.tar cuberite-dc878898f36473c4df54457d2738562df4dec908.tar.gz cuberite-dc878898f36473c4df54457d2738562df4dec908.tar.bz2 cuberite-dc878898f36473c4df54457d2738562df4dec908.tar.lz cuberite-dc878898f36473c4df54457d2738562df4dec908.tar.xz cuberite-dc878898f36473c4df54457d2738562df4dec908.tar.zst cuberite-dc878898f36473c4df54457d2738562df4dec908.zip |
Diffstat (limited to '')
-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 |