summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c9
-rw-r--r--src/map/itemdb.h1
-rw-r--r--src/map/pc.c2
3 files changed, 11 insertions, 1 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 508a0ccec..545ce9ba0 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -2054,6 +2054,14 @@ struct item_combo * itemdb_id2combo( unsigned short id ) {
return itemdb->combos[id];
}
+/**
+ * check is item have usable type
+ **/
+bool itemdb_is_item_usable(struct item_data *item)
+{
+ return item->type == IT_HEALING || item->type == IT_USABLE || item->type == IT_CASH;
+}
+
/*==========================================
* Initialize / Finalize
*------------------------------------------*/
@@ -2337,4 +2345,5 @@ void itemdb_defaults(void) {
itemdb->final_sub = itemdb_final_sub;
itemdb->clear = itemdb_clear;
itemdb->id2combo = itemdb_id2combo;
+ itemdb->is_item_usable = itemdb_is_item_usable;
}
diff --git a/src/map/itemdb.h b/src/map/itemdb.h
index 5504d72d9..23339790e 100644
--- a/src/map/itemdb.h
+++ b/src/map/itemdb.h
@@ -610,6 +610,7 @@ struct itemdb_interface {
int (*final_sub) (DBKey key, DBData *data, va_list ap);
void (*clear) (bool total);
struct item_combo * (*id2combo) (unsigned short id);
+ bool (*is_item_usable) (struct item_data *item);
};
struct itemdb_interface *itemdb;
diff --git a/src/map/pc.c b/src/map/pc.c
index 5c6cac6e9..6c3a32152 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4238,7 +4238,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
if( item == NULL )
return 0;
//Not consumable item
- if( item->type != IT_HEALING && item->type != IT_USABLE && item->type != IT_CASH )
+ if (!itemdb->is_item_usable(item))
return 0;
if( !item->script ) //if it has no script, you can't really consume it!
return 0;