Changed ItemUseType enumeration to ItemInstTypes enumeration - naming conflicted with definition

This commit is contained in:
Uleat 2013-10-27 05:45:52 -04:00
parent d5152a0e59
commit e53fa1d873
5 changed files with 18 additions and 15 deletions

View File

@ -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: 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: 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: 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 == == 10/24/2013 ==
demonstar55: Fix some memory leaks in Mob::SpellOnTarget demonstar55: Fix some memory leaks in Mob::SpellOnTarget

View File

@ -54,7 +54,7 @@ static inline int32 GetNextItemInstSerialNumber() {
} }
ItemInst::ItemInst(const Item_Struct* item, int16 charges) { ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
m_use_type = ItemUseNormal; m_use_type = ItemInstNormal;
m_item = item; m_item = item;
m_charges = charges; m_charges = charges;
m_price = 0; m_price = 0;
@ -76,7 +76,7 @@ ItemInst::ItemInst(const Item_Struct* item, int16 charges) {
} }
ItemInst::ItemInst(SharedDatabase *db, uint32 item_id, 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_item = db->GetItem(item_id);
m_charges = charges; m_charges = charges;
m_price = 0; m_price = 0;
@ -223,7 +223,7 @@ ItemInst* ItemInst::Clone() const
bool ItemInst::IsType(ItemClass item_class) const bool ItemInst::IsType(ItemClass item_class) const
{ {
// Check usage type // Check usage type
if ((m_use_type == ItemUseWorldContainer) && (item_class == ItemClassContainer)) if ((m_use_type == ItemInstWorldContainer) && (item_class == ItemClassContainer))
return true; return true;
if (!m_item) if (!m_item)

View File

@ -39,13 +39,15 @@ class EvolveInfo; // Stores information about an evolving item family
#include "../common/timer.h" #include "../common/timer.h"
// Helper typedefs // Helper typedefs
typedef std::list<ItemInst*>::const_iterator iter_queue; typedef std::list<ItemInst*>::const_iterator iter_queue;
typedef std::map<int16, ItemInst*>::const_iterator iter_inst; typedef std::map<int16, ItemInst*>::const_iterator iter_inst;
typedef std::map<uint8, ItemInst*>::const_iterator iter_contents; typedef std::map<uint8, ItemInst*>::const_iterator iter_contents;
namespace ItemField { namespace ItemField
enum { {
source=0, enum
{
source = 0,
#define F(x) x, #define F(x) x,
#include "item_fieldlist.h" #include "item_fieldlist.h"
#undef F #undef F
@ -69,10 +71,10 @@ namespace ItemField {
#define MAX_ITEMS_PER_BAG 10 #define MAX_ITEMS_PER_BAG 10
// Specifies usage type for item inside ItemInst // Specifies usage type for item inside ItemInst
enum ItemUseType enum ItemInstTypes
{ {
ItemUseNormal, ItemInstNormal = 0,
ItemUseWorldContainer ItemInstWorldContainer
}; };
typedef enum { typedef enum {
@ -263,7 +265,7 @@ public:
ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0); ItemInst(SharedDatabase *db, uint32 item_id, int16 charges = 0);
ItemInst(ItemUseType use_type) { ItemInst(ItemInstTypes use_type) {
m_use_type = use_type; m_use_type = use_type;
m_item = nullptr; m_item = nullptr;
m_charges = 0; m_charges = 0;
@ -421,7 +423,7 @@ protected:
void _PutItem(uint8 index, ItemInst* inst) { m_contents[index] = inst; } 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 const Item_Struct* m_item; // Ptr to item data
int16 m_charges; // # of charges for chargeable items int16 m_charges; // # of charges for chargeable items
uint32 m_price; // Bazaar /trader price uint32 m_price; // Bazaar /trader price

View File

@ -218,7 +218,7 @@ Object::Object(const char *model, float x, float y, float z, float heading, uint
user = nullptr; user = nullptr;
last_user = nullptr; last_user = nullptr;
ItemInst* inst = nullptr; ItemInst* inst = nullptr;
inst = new ItemInst(ItemUseWorldContainer); inst = new ItemInst(ItemInstWorldContainer);
// Initialize members // Initialize members
m_id = 0; m_id = 0;

View File

@ -270,7 +270,7 @@ bool Zone::LoadZoneObjects() {
//tradeskill containers do not have an itemid of 0... at least what I am seeing //tradeskill containers do not have an itemid of 0... at least what I am seeing
if (itemid == 0) { if (itemid == 0) {
// Generic tradeskill container // Generic tradeskill container
inst = new ItemInst(ItemUseWorldContainer); inst = new ItemInst(ItemInstWorldContainer);
} }
else { else {
// Groundspawn object // Groundspawn object
@ -279,7 +279,7 @@ bool Zone::LoadZoneObjects() {
//Father Nitwit's fix... not perfect... //Father Nitwit's fix... not perfect...
if(inst == nullptr && type != OT_DROPPEDITEM) { if(inst == nullptr && type != OT_DROPPEDITEM) {
inst = new ItemInst(ItemUseWorldContainer); inst = new ItemInst(ItemInstWorldContainer);
} }
// Load child objects if container // Load child objects if container