From 5de3852d0e203ad08e4bdd748a49f8dba2e028c2 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 1 Feb 2007 21:04:46 +0000 Subject: - Item search is now a bit smarter. When no item is found with the same 'aegis name', then the 'normal' name is used instead. - Updated the @/# commands that take an item name so that you can use quotes when specifying item names with spaces in them. For example, @item "poring card" 1 will work now. Note that only the commands that work on ONE item have been updated, those that do an item list need to be updated as well. - Removed some garbage from the item_data structure. - Improved a bit the description of the mvp item get time config settings. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9767 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index c2c98f42b..f39e3d809 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -28,29 +28,22 @@ struct item_data dummy_item; //This is the default dummy item used for non-exist // name = item alias, so we should find items aliases first. if not found then look for "jname" (full name) int itemdb_searchname_sub(DBKey key,void *data,va_list ap) { - struct item_data *item=(struct item_data *)data,**dst; + struct item_data *item=(struct item_data *)data,**dst,**dst2; char *str; str=va_arg(ap,char *); dst=va_arg(ap,struct item_data **); + dst2=va_arg(ap,struct item_data **); if(item == &dummy_item) return 0; - if( strcmpi(item->name,str)==0 ) //by lupus + + //Absolute priority to Aegis code name. + if (*dst != NULL) return 0; + if( strcmpi(item->name,str)==0 ) *dst=item; - return 0; -} -/*========================================== - * 名前で検索用 - *------------------------------------------ - */ -int itemdb_searchjname_sub(int key,void *data,va_list ap) -{ - struct item_data *item=(struct item_data *)data,**dst; - char *str; - str=va_arg(ap,char *); - dst=va_arg(ap,struct item_data **); - if(item == &dummy_item) return 0; + //Second priority to Client displayed name. + if (*dst2 != NULL) return 0; if( strcmpi(item->jname,str)==0 ) - *dst=item; + *dst2=item; return 0; } @@ -60,9 +53,10 @@ int itemdb_searchjname_sub(int key,void *data,va_list ap) */ struct item_data* itemdb_searchname(const char *str) { - struct item_data *item=NULL; - item_db->foreach(item_db,itemdb_searchname_sub,str,&item); - return item; + struct item_data *item=NULL, *item2=NULL; + + item_db->foreach(item_db,itemdb_searchname_sub,str,&item,&item2); + return item?item:item2; } static int itemdb_searchname_array_sub(DBKey key,void * data,va_list ap) -- cgit v1.2.3-70-g09d2