- Updated the item_db search functions so that when returning the dummy-item, it first updates the nameid to match the requested one, this prevents pc_additem later on giving you an item with ID 500 instead of the ID requested.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8764 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-09-15 01:02:20 +00:00
parent 25b73f7772
commit ae631dda54
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/09/14 2006/09/14
* Updated the item_db search functions so that when returning the
dummy-item, it first updates the nameid to match the requested one, this
prevents pc_additem later on giving you an item with ID 500 instead of the
ID requested. [Skotlex]
* Added a clif_skill_nodamage packet when using Repair Weapon, just to see * Added a clif_skill_nodamage packet when using Repair Weapon, just to see
what happens. [Skotlex] what happens. [Skotlex]
* Likely fixed "half" of the alliance being saved, which ends up in guilds * Likely fixed "half" of the alliance being saved, which ends up in guilds

View File

@ -53,6 +53,7 @@ int itemdb_searchjname_sub(int key,void *data,va_list ap)
char *str; char *str;
str=va_arg(ap,char *); str=va_arg(ap,char *);
dst=va_arg(ap,struct item_data **); dst=va_arg(ap,struct item_data **);
if(item == &dummy_item) return 0;
if( strcmpi(item->jname,str)==0 ) if( strcmpi(item->jname,str)==0 )
*dst=item; *dst=item;
return 0; return 0;
@ -142,7 +143,9 @@ struct item_data* itemdb_exists(int nameid)
struct item_data* id; struct item_data* id;
if (!nameid) return NULL; if (!nameid) return NULL;
id = idb_get(item_db,nameid); id = idb_get(item_db,nameid);
// if (id == &dummy_item) return NULL; //Let dummy items go through... technically they "exist" because someone already has them... //Adjust nameid in case it's used outside. [Skotlex]
if (id == &dummy_item)
dummy_item.nameid = nameid;
return id; return id;
} }
@ -249,6 +252,7 @@ struct item_data* itemdb_load(int nameid)
static void* return_dummy_data(DBKey key, va_list args) { static void* return_dummy_data(DBKey key, va_list args) {
if (battle_config.error_log) if (battle_config.error_log)
ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i); ShowWarning("itemdb_search: Item ID %d does not exists in the item_db. Using dummy data.\n", key.i);
dummy_item.nameid = key.i;
return &dummy_item; return &dummy_item;
} }