From 2691e8daed826e944ca38f4787c77273edbf9404 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 18 Aug 2012 09:56:28 +0000 Subject: Packet refactoring, phase two, partial. Rewritten a few packet handling functions not to use cPacket-descendant objects. This breaks plugin API! Plugins need to modify their hook functions to match those used in the Core plugin git-svn-id: http://mc-server.googlecode.com/svn/trunk@750 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cItem.h | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'source/cItem.h') diff --git a/source/cItem.h b/source/cItem.h index 15a6e3ca1..53764d06a 100644 --- a/source/cItem.h +++ b/source/cItem.h @@ -39,9 +39,23 @@ public: { return (m_ItemID <= 0 || m_ItemCount <= 0); } - bool Equals( cItem & a_Item ) const + + // tolua_end + OBSOLETE + // tolua_begin + bool Equals(const cItem & a_Item) const // obsolete, use IsEqual() instead + { + return IsEqual(a_Item); + } + + bool IsEqual(const cItem & a_Item) const + { + return (IsSameType(a_Item) && (m_ItemHealth == a_Item.m_ItemHealth)); + } + + bool IsSameType(const cItem & a_Item) const { - return ( (m_ItemID == a_Item.m_ItemID) && (m_ItemHealth == a_Item.m_ItemHealth) ); + return (m_ItemID == a_Item.m_ItemID) || (IsEmpty() && a_Item.IsEmpty()); } // TODO Sorry for writing the functions in the header. But somehow it doesn´t worked when I put them into the cpp File :s @@ -100,12 +114,25 @@ public: void FromJson( const Json::Value & a_Value ); // tolua_begin - static bool IsEnchantable(ENUM_ITEM_ID item); - - ENUM_ITEM_ID m_ItemID; - char m_ItemCount; - short m_ItemHealth; + static bool IsEnchantable(short a_ItemType); + // tolua_end + union + { + // tolua_begin + ENUM_ITEM_ID m_ItemID; // OBSOLETE, use m_ItemType instead + short m_ItemType; + // tolua_end + } ; + char m_ItemCount; // tolua_export + union + { + // tolua_begin + short m_ItemHealth; // OBSOLETE, use m_ItemDamage instead + short m_ItemDamage; + // tolua_end + } ; + // tolua_begin }; // tolua_end -- cgit v1.2.3