summaryrefslogtreecommitdiffstats
path: root/src/Item.h
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
committerJulian Laubstein <julianlaubstein@yahoo.de>2016-02-06 11:37:34 +0100
commit6fdd7194c81be7234a126bdc3b48f0291fce3567 (patch)
tree7d5ac74b7385ce4ebf77588d80549c884c2b993c /src/Item.h
parentMerge pull request #2958 from LogicParrot/fence (diff)
parentBulk clearing of whitespace (diff)
downloadcuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.gz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.bz2
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.lz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.xz
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.tar.zst
cuberite-6fdd7194c81be7234a126bdc3b48f0291fce3567.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