summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-01 21:04:46 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-02-01 21:04:46 +0000
commit5de3852d0e203ad08e4bdd748a49f8dba2e028c2 (patch)
treee4a1fce223b40e891fc5395c749d47b4de1fcd41 /src/map/itemdb.c
parentca0aa0f7e55896730f6470a7dec81e6293b305ff (diff)
downloadhercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.gz
hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.bz2
hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.tar.xz
hercules-5de3852d0e203ad08e4bdd748a49f8dba2e028c2.zip
- 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
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c32
1 files changed, 13 insertions, 19 deletions
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)