From a19a0701211e0a5563dc77845e11a3f3308e2b32 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 2 Jun 2013 10:40:20 +0000 Subject: Enchantments: API and sending to client git-svn-id: http://mc-server.googlecode.com/svn/trunk@1539 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Item.h | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) (limited to 'source/Item.h') diff --git a/source/Item.h b/source/Item.h index 45b124e67..fee549a2c 100644 --- a/source/Item.h +++ b/source/Item.h @@ -1,7 +1,20 @@ + +// Item.h + +// Declares the cItem class representing an item (in the inventory sense) + + + + + #pragma once #include "Defines.h" -#include "BlockID.h" +#include "Enchantments.h" + + + + namespace Json { @@ -25,15 +38,17 @@ public: } - /// Creates an item of the specified type, by default 1 piece with no damage + /// Creates an item of the specified type, by default 1 piece with no damage and no enchantments cItem( short a_ItemType, char a_ItemCount = 1, - short a_ItemDamage = 0 + short a_ItemDamage = 0, + const AString & a_Enchantments = "" ) : - m_ItemType (a_ItemType), - m_ItemCount (a_ItemCount), - m_ItemDamage(a_ItemDamage) + m_ItemType (a_ItemType), + m_ItemCount (a_ItemCount), + m_ItemDamage (a_ItemDamage), + m_Enchantments(a_Enchantments) { if (!IsValidItem(m_ItemType)) { @@ -48,6 +63,7 @@ public: m_ItemType = E_ITEM_EMPTY; m_ItemCount = 0; m_ItemDamage = 0; + m_Enchantments.Clear(); } @@ -98,9 +114,10 @@ public: static bool IsEnchantable(short a_ItemType); - short m_ItemType; - char m_ItemCount; - short m_ItemDamage; + short m_ItemType; + char m_ItemCount; + short m_ItemDamage; + cEnchantments m_Enchantments; }; // tolua_end -- cgit v1.2.3