summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-10 15:16:20 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-10 15:16:20 +0000
commit14bdff735de758412712d0c36af2d4a723752dbc (patch)
treecedb49de6bc2f9bae0593e47fd3386702cba9b94 /src/map
parent436e7522b5dd736e0ab955028ac14b4cbf77810d (diff)
downloadhercules-14bdff735de758412712d0c36af2d4a723752dbc.tar.gz
hercules-14bdff735de758412712d0c36af2d4a723752dbc.tar.bz2
hercules-14bdff735de758412712d0c36af2d4a723752dbc.tar.xz
hercules-14bdff735de758412712d0c36af2d4a723752dbc.zip
- One closer inspection, removed that clear in itemdb_reload for a foreach call again. And modified itemdb_load to scrap the dummy item entry from the item_db and replace it with proper data for the item.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7597 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/itemdb.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 56b1182b7..ddae6b38a 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -228,7 +228,16 @@ static void* create_item_data(DBKey key, va_list args) {
*/
struct item_data* itemdb_load(int nameid)
{
- return idb_ensure(item_db,nameid,create_item_data);
+ struct item_data *id = idb_ensure(item_db,nameid,create_item_data);
+ if (id == &dummy_item)
+ { //Remove dummy_item, replace by real data.
+ DBKey key;
+ key.i = nameid;
+ idb_remove(item_db,nameid);
+ id = create_item_data(key, NULL);
+ idb_put(item_db,nameid,id);
+ }
+ return id;
}
static void* return_dummy_data(DBKey key, va_list args) {
@@ -1193,7 +1202,7 @@ static int itemdb_final_sub (DBKey key,void *data,va_list ap)
void itemdb_reload(void)
{
// free up all item scripts first
- item_db->clear(item_db, itemdb_final_sub, 0);
+ item_db->foreach(item_db, itemdb_final_sub, 0);
itemdb_read();
}