summaryrefslogtreecommitdiffstats
path: root/source/Item.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/Item.h')
-rw-r--r--source/Item.h25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/Item.h b/source/Item.h
index 9e37ce3bc..45b124e67 100644
--- a/source/Item.h
+++ b/source/Item.h
@@ -16,14 +16,29 @@ namespace Json
class cItem
{
public:
- cItem(short a_ItemType = E_ITEM_EMPTY, char a_ItemCount = 0, short a_ItemDamage = 0)
- : m_ItemType (a_ItemType)
- , m_ItemCount (a_ItemCount)
- , m_ItemDamage(a_ItemDamage)
+ /// Creates an empty item
+ cItem(void) :
+ m_ItemType(E_ITEM_EMPTY),
+ m_ItemCount(0),
+ m_ItemDamage(0)
+ {
+ }
+
+
+ /// Creates an item of the specified type, by default 1 piece with no damage
+ cItem(
+ short a_ItemType,
+ char a_ItemCount = 1,
+ short a_ItemDamage = 0
+ ) :
+ m_ItemType (a_ItemType),
+ m_ItemCount (a_ItemCount),
+ m_ItemDamage(a_ItemDamage)
{
if (!IsValidItem(m_ItemType))
{
- m_ItemType = E_ITEM_EMPTY;
+ LOGWARNING("%s: creating an invalid item type (%d), resetting to empty.", __FUNCTION__, a_ItemType);
+ Empty();
}
}