From e53fa1d873825fa3b3750869185a3164b7380b3b Mon Sep 17 00:00:00 2001 From: Uleat Date: Sun, 27 Oct 2013 05:45:52 -0400 Subject: [PATCH] Changed ItemUseType enumeration to ItemInstTypes enumeration - naming conflicted with definition --- changelog.txt | 1 + common/Item.cpp | 6 +++--- common/Item.h | 20 +++++++++++--------- zone/Object.cpp | 2 +- zone/zone.cpp | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/changelog.txt b/changelog.txt index 1f1037e95..c90bd9765 100644 --- a/changelog.txt +++ b/changelog.txt @@ -10,6 +10,7 @@ Notes: Uleat: Changed riposte enabling check to proper failure criteria (x == 1 && x == 2 never fails) (discovery find, no known reported occurences) Uleat: Enforced naming standard on my recent changes (Sorry for any inconviencies) Uleat: Moved DeityTypes enumeration from eq_constants.h to deity.h (expanded utility of accessors, but are yet to be implemented) +Uleat: Changed ItemUseType to ItemInstTypes to better reflect the definition (also to free-up the namespace) == 10/24/2013 == demonstar55: Fix some memory leaks in Mob::SpellOnTarget diff --git a/common/Item.cpp b/common/Item.cpp index 0596815e0..457aed53f 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -54,7 +54,7 @@ static inline int32 GetNextItemInstSerialNumber() { } ItemInst::ItemInst(const Item_Struct* item, int16 charges) { - m_use_type = ItemUseNormal; + m_use_type = ItemInstNormal; m_item = item; m_charges = charges; m_price = 0; @@ -76,7 +76,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) { } ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, int16 charges) { - m_use_type = ItemUseNormal; + m_use_type = ItemInstNormal; m_item = db->GetItem(item_id); m_charges = charges; m_price = 0; @@ -223,7 +223,7 @@ ItemInst* ItemInst::Clone() const bool ItemInst::IsType(ItemClass item_class) const { // Check usage type - if ((m_use_type == ItemUseWorldContainer) && (item_class == ItemClassContainer)) + if ((m_use_type == ItemInstWorldContainer) && (item_class == ItemClassContainer)) return true; if (!m_item) diff --git a/common/Item.h b/common/Item.h index 47eb7556a..1b1fabf57 100644 --- a/common/Item.h +++ b/common/Item.h @@ -39,13 +39,15 @@ class EvolveInfo; // Stores information about an evolving item family #include "../common/timer.h" // Helper typedefs -typedef std::list::const_iterator iter_queue; +typedef std::list::const_iterator iter_queue; typedef std::map::const_iterator iter_inst; typedef std::map::const_iterator iter_contents; -namespace ItemField { - enum { - source=0, +namespace ItemField +{ + enum + { + source = 0, #define F(x) x, #include "item_fieldlist.h" #undef F @@ -69,10 +71,10 @@ namespace ItemField { #define MAX_ITEMS_PER_BAG 10 // Specifies usage type for item inside ItemInst -enum ItemUseType +enum ItemInstTypes { - ItemUseNormal, - ItemUseWorldContainer + ItemInstNormal = 0, + ItemInstWorldContainer }; typedef enum { @@ -263,7 +265,7 @@ public: ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); - ItemInst(ItemUseType use_type) { + ItemInst(ItemInstTypes use_type) { m_use_type = use_type; m_item = nullptr; m_charges = 0; @@ -421,7 +423,7 @@ protected: void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } - ItemUseType m_use_type; // Usage type for item + ItemInstTypes m_use_type; // Usage type for item const Item_Struct* m_item; // Ptr to item data int16 m_charges; // # of charges for chargeable items uint32 m_price; // Bazaar /trader price diff --git a/zone/Object.cpp b/zone/Object.cpp index c4a8b0b3b..1f4dc3654 100644 --- a/zone/Object.cpp +++ b/zone/Object.cpp @@ -218,7 +218,7 @@ Object::Object(const char *model, float x, float y, float z, float heading, uint user = nullptr; last_user = nullptr; ItemInst* inst = nullptr; - inst = new ItemInst(ItemUseWorldContainer); + inst = new ItemInst(ItemInstWorldContainer); // Initialize members m_id = 0; diff --git a/zone/zone.cpp b/zone/zone.cpp index 98f0126eb..dfddf22ff 100644 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -270,7 +270,7 @@ bool Zone::LoadZoneObjects() { //tradeskill containers do not have an itemid of 0... at least what I am seeing if (itemid == 0) { // Generic tradeskill container - inst = new ItemInst(ItemUseWorldContainer); + inst = new ItemInst(ItemInstWorldContainer); } else { // Groundspawn object @@ -279,7 +279,7 @@ bool Zone::LoadZoneObjects() { //Father Nitwit's fix... not perfect... if(inst == nullptr && type != OT_DROPPEDITEM) { - inst = new ItemInst(ItemUseWorldContainer); + inst = new ItemInst(ItemInstWorldContainer); } // Load child objects if container