diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-01 09:54:04 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-01 09:54:04 +0200 |
commit | 7c0be7520ac70ceed378856aa95a062935d80442 (patch) | |
tree | 3d228c759b47a2744bcceedffa7ebe53214b36a3 /source/Item.h | |
parent | Added cLuaWindow:SetOnSlotChanged(); the callback is called only for non-inventory slots (diff) | |
download | cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar.gz cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar.bz2 cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar.lz cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar.xz cuberite-7c0be7520ac70ceed378856aa95a062935d80442.tar.zst cuberite-7c0be7520ac70ceed378856aa95a062935d80442.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Item.h | 25 |
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(); } } |