From f2b579077649d5f40e0e60b53e60fe3b4804dada Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Apr 2014 17:36:51 +0200 Subject: Fixed a warning when an empty item is being created. --- src/Item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 00316c188..641c681db 100644 --- a/src/Item.h +++ b/src/Item.h @@ -64,7 +64,7 @@ public: { if (!IsValidItem(m_ItemType)) { - if (m_ItemType != E_BLOCK_AIR) + if ((m_ItemType != E_BLOCK_AIR) && (m_ItemType != E_ITEM_EMPTY)) { LOGWARNING("%s: creating an invalid item type (%d), resetting to empty.", __FUNCTION__, a_ItemType); } -- cgit v1.2.3 From b0056cdcf8a36efbed4b97414ebf5741b56a5895 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:02:25 +0200 Subject: Removed the explicit copy constructor for cItem. The compiler generates an implicit one with the same contents and warns about it. The function left in for ToLua to generate the binding for it. --- src/Item.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 641c681db..8eb0a1f4e 100644 --- a/src/Item.h +++ b/src/Item.h @@ -73,6 +73,10 @@ public: } + // 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), @@ -85,6 +89,8 @@ public: { } + #endif + void Empty(void) { -- cgit v1.2.3 From d6cb6e0423fe38478c69f5d249882a01d727f0ed Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 7 May 2014 12:30:30 +0200 Subject: Add repair cost to cItem, add custom name to NBTChunkSerializer and fix anvil bugs. --- src/Item.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 8eb0a1f4e..7e2fc6cff 100644 --- a/src/Item.h +++ b/src/Item.h @@ -40,6 +40,7 @@ public: m_ItemDamage(0), m_CustomName(""), m_Lore(""), + m_RepairCost(0), m_FireworkItem() { } @@ -60,6 +61,7 @@ public: m_Enchantments(a_Enchantments), m_CustomName (a_CustomName), m_Lore (a_Lore), + m_RepairCost (0), m_FireworkItem() { if (!IsValidItem(m_ItemType)) @@ -85,7 +87,8 @@ public: m_Enchantments(a_CopyFrom.m_Enchantments), m_CustomName (a_CopyFrom.m_CustomName), m_Lore (a_CopyFrom.m_Lore), - m_FireworkItem(a_CopyFrom.m_FireworkItem) + m_FireworkItem(a_CopyFrom.m_FireworkItem), + m_RepairCost (a_CopyFrom.m_RepairCost) { } @@ -100,6 +103,7 @@ public: m_Enchantments.Clear(); m_CustomName = ""; m_Lore = ""; + m_RepairCost = 0; m_FireworkItem.EmptyData(); } @@ -109,6 +113,7 @@ public: m_ItemType = E_ITEM_EMPTY; m_ItemCount = 0; m_ItemDamage = 0; + m_RepairCost = 0; } @@ -190,14 +195,15 @@ public: // tolua_begin - short m_ItemType; - char m_ItemCount; - short m_ItemDamage; - cEnchantments m_Enchantments; - AString m_CustomName; - AString m_Lore; - - cFireworkItem m_FireworkItem; + short m_ItemType; + char m_ItemCount; + short m_ItemDamage; + cEnchantments m_Enchantments; + AString m_CustomName; + AString m_Lore; + + cFireworkItem m_FireworkItem; + UInt16 m_RepairCost; }; // tolua_end -- cgit v1.2.3 From e86bf64867dd6da877934fee4ac5bafedc464389 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 7 May 2014 12:45:20 +0200 Subject: Where is the problem with clang? --- src/Item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 7e2fc6cff..2a1978aad 100644 --- a/src/Item.h +++ b/src/Item.h @@ -202,8 +202,8 @@ public: AString m_CustomName; AString m_Lore; - cFireworkItem m_FireworkItem; UInt16 m_RepairCost; + cFireworkItem m_FireworkItem; }; // tolua_end -- cgit v1.2.3 From fbb6404cc8793f5caef374e1eda243fa2d159eb5 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 7 May 2014 20:43:37 +0200 Subject: Change m_RepairCost to int. --- src/Item.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 2a1978aad..1ac9280fc 100644 --- a/src/Item.h +++ b/src/Item.h @@ -87,8 +87,8 @@ public: m_Enchantments(a_CopyFrom.m_Enchantments), m_CustomName (a_CopyFrom.m_CustomName), m_Lore (a_CopyFrom.m_Lore), - m_FireworkItem(a_CopyFrom.m_FireworkItem), m_RepairCost (a_CopyFrom.m_RepairCost) + m_FireworkItem(a_CopyFrom.m_FireworkItem), { } @@ -202,7 +202,7 @@ public: AString m_CustomName; AString m_Lore; - UInt16 m_RepairCost; + int m_RepairCost; cFireworkItem m_FireworkItem; }; // tolua_end -- cgit v1.2.3 From df71cc931b793dc88f93bc44618d910b0bb978ee Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 7 May 2014 21:32:52 +0200 Subject: Missing comma --- src/Item.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 1ac9280fc..2f65d5344 100644 --- a/src/Item.h +++ b/src/Item.h @@ -87,8 +87,8 @@ public: m_Enchantments(a_CopyFrom.m_Enchantments), m_CustomName (a_CopyFrom.m_CustomName), m_Lore (a_CopyFrom.m_Lore), - m_RepairCost (a_CopyFrom.m_RepairCost) - m_FireworkItem(a_CopyFrom.m_FireworkItem), + m_RepairCost (a_CopyFrom.m_RepairCost), + m_FireworkItem(a_CopyFrom.m_FireworkItem) { } -- cgit v1.2.3 From aea866f5b10d5ab0226260b4d25c70b1cfd31d2a Mon Sep 17 00:00:00 2001 From: andrew Date: Mon, 12 May 2014 21:38:52 +0300 Subject: Movement Statistics --- src/Item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 2f65d5344..acbc880dc 100644 --- a/src/Item.h +++ b/src/Item.h @@ -228,7 +228,7 @@ public: void Add (const cItem & a_Item) {push_back(a_Item); } void Delete(int a_Idx); void Clear (void) {clear(); } - size_t Size (void) {return size(); } + size_t Size (void) const { return size(); } void Set (int a_Idx, short a_ItemType, char a_ItemCount, short a_ItemDamage); void Add (short a_ItemType, char a_ItemCount, short a_ItemDamage) -- cgit v1.2.3 From 993fd14ddfc881cf5be951df77da0338124d68cc Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 17 Jul 2014 16:33:09 +0200 Subject: Fixed basic whitespace problems. Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines. --- src/Item.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index acbc880dc..d8b9e78a0 100644 --- a/src/Item.h +++ b/src/Item.h @@ -150,7 +150,7 @@ public: bool IsCustomNameEmpty(void) const { return (m_CustomName.empty()); } - bool IsLoreEmpty(void) const { return (m_Lore.empty()); } + bool IsLoreEmpty(void) const { return (m_Lore.empty()); } /** Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items */ cItem CopyOne(void) const; @@ -184,14 +184,14 @@ public: void FromJson(const Json::Value & a_Value); /** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */ - static bool IsEnchantable(short a_ItemType); // tolua_export + static bool IsEnchantable(short a_ItemType); // tolua_export /** Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0 */ - int GetEnchantability(); // tolua_export + int GetEnchantability(); // tolua_export /** Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not. */ - bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export + bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export // tolua_begin -- cgit v1.2.3