diff options
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 431ee3135..fcd4ccbc1 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -102,8 +102,11 @@ static int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap) /*========================================== * Founds up to N matches. Returns number of matches [Skotlex] + * search flag : + * 0 - approximate match + * 1 - exact match *------------------------------------------*/ -int itemdb_searchname_array(struct item_data** data, int size, const char *str) { +int itemdb_searchname_array(struct item_data** data, int size, const char *str, int flag) { struct item_data* item; int i; int count=0; @@ -115,7 +118,8 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str) if( item == NULL ) continue; - if( stristr(item->jname,str) || stristr(item->name,str) ) + if( (!flag && (stristr(item->jname,str) || stristr(item->name,str))) || + (flag && (strcmp(item->jname,str) == 0 || strcmp(item->name,str) == 0)) ) { if( count < size ) data[count] = item; |