summaryrefslogtreecommitdiffstats
path: root/src/Item.h
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:45:45 +0100
committerLogicParrot <LogicParrot@users.noreply.github.com>2016-02-05 22:50:18 +0100
commitca6ef58b1ee8521e4b940ee4883dee714960e413 (patch)
tree8532add455224b07c07a759e3d906f50c0695888 /src/Item.h
parentMerge pull request #2972 from marvinkopf/PlayerAutoComplete (diff)
downloadcuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.gz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.bz2
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.lz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.xz
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.tar.zst
cuberite-ca6ef58b1ee8521e4b940ee4883dee714960e413.zip
Diffstat (limited to '')
-rw-r--r--src/Item.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/Item.h b/src/Item.h
index 46b3c2ef1..fb52c75fa 100644
--- a/src/Item.h
+++ b/src/Item.h
@@ -47,8 +47,8 @@ public:
m_ItemColor()
{
}
-
-
+
+
/** Creates an item of the specified type, by default 1 piece with no damage and no enchantments */
cItem(
short a_ItemType,
@@ -77,12 +77,12 @@ public:
Empty();
}
}
-
-
+
+
// The constructor is disabled in code, because the compiler generates it anyway,
// but it needs to stay because ToLua needs to generate the binding for it
#if 0
-
+
/** Creates an exact copy of the item */
cItem(const cItem & a_CopyFrom) :
m_ItemType (a_CopyFrom.m_ItemType),
@@ -95,10 +95,10 @@ public:
m_FireworkItem(a_CopyFrom.m_FireworkItem)
{
}
-
+
#endif
-
-
+
+
void Empty(void)
{
m_ItemType = E_ITEM_EMPTY;
@@ -111,8 +111,8 @@ public:
m_FireworkItem.EmptyData();
m_ItemColor.Clear();
}
-
-
+
+
void Clear(void)
{
m_ItemType = E_ITEM_EMPTY;
@@ -121,13 +121,13 @@ public:
m_RepairCost = 0;
m_ItemColor.Clear();
}
-
-
+
+
bool IsEmpty(void) const
{
return ((m_ItemType <= 0) || (m_ItemCount <= 0));
}
-
+
/* Returns true if this itemstack can stack with the specified stack (types match, enchantments etc.)
ItemCounts are ignored. */
bool IsEqual(const cItem & a_Item) const
@@ -141,8 +141,8 @@ public:
m_FireworkItem.IsEqualTo(a_Item.m_FireworkItem)
);
}
-
-
+
+
bool IsSameType(const cItem & a_Item) const
{
return (m_ItemType == a_Item.m_ItemType) || (IsEmpty() && a_Item.IsEmpty());
@@ -160,35 +160,35 @@ public:
/** Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items */
cItem CopyOne(void) const;
-
+
/** Adds the specified count to this object and returns the reference to self (useful for chaining) */
cItem & AddCount(char a_AmountToAdd);
-
+
/** Returns the maximum damage value that this item can have; zero if damage is not applied */
short GetMaxDamage(void) const;
-
+
/** Damages a weapon / tool. Returns true when damage reaches max value and the item should be destroyed */
bool DamageItem(short a_Amount = 1);
inline bool IsDamageable(void) const { return (GetMaxDamage() > 0); }
-
+
/** Returns true if the item is stacked up to its maximum stacking. */
bool IsFullStack(void) const;
-
+
/** Returns the maximum amount of stacked items of this type. */
char GetMaxStackSize(void) const;
// tolua_end
-
+
/** Returns the cItemHandler responsible for this item type */
cItemHandler * GetHandler(void) const;
-
+
/** Saves the item data into JSON representation */
void GetJson(Json::Value & a_OutValue) const;
-
+
/** Loads the item data from JSON representation */
void FromJson(const Json::Value & a_Value);
-
+
/** Returns true if the specified item type is enchantable.
If WithBook is true, the function is used in the anvil inventory with book enchantments.
So it checks the "only book enchantments" too. Example: You can only enchant a hoe with a book. */
@@ -202,7 +202,7 @@ public:
bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export
// tolua_begin
-
+
short m_ItemType;
char m_ItemCount;
short m_ItemDamage;
@@ -228,10 +228,10 @@ class cItems // tolua_export
{ // tolua_export
public:
// tolua_begin
-
+
/** Need a Lua-accessible constructor */
cItems(void) {}
-
+
cItem * Get (int a_Idx);
void Set (int a_Idx, const cItem & a_Item);
void Add (const cItem & a_Item) {push_back(a_Item); }
@@ -246,7 +246,7 @@ public:
{
push_back(cItem(a_ItemType, a_ItemCount, a_ItemDamage));
}
-
+
// tolua_end
} ; // tolua_export