diff options
author | Kevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-23 20:54:07 +0000 |
---|---|---|
committer | Kevin <Kevin@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-04-23 20:54:07 +0000 |
commit | 709fc6edc72b8a9aec91bbc0c0006ea5073c00fb (patch) | |
tree | b9028f6f549d974c2dffef11ebe1e687d87a8c21 /src/map/itemdb.c | |
parent | f09707bb9ea08e32d849ae2019d16cd7e14606a7 (diff) | |
download | hercules-709fc6edc72b8a9aec91bbc0c0006ea5073c00fb.tar.gz hercules-709fc6edc72b8a9aec91bbc0c0006ea5073c00fb.tar.bz2 hercules-709fc6edc72b8a9aec91bbc0c0006ea5073c00fb.tar.xz hercules-709fc6edc72b8a9aec91bbc0c0006ea5073c00fb.zip |
Changed @reloaditemdb again to only unload items from item_db2. Also byte aligned the item_data struct a bit.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12643 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 25b47eb64..442508775 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -689,7 +689,7 @@ static int itemdb_gendercheck(struct item_data *id) /*========================================== * processes one itemdb entry *------------------------------------------*/ -static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt) +static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt, int db) { /* +----+--------------+---------------+------+-----------+------------+--------+--------+---------+-------+-------+------------+-------------+---------------+-----------------+--------------+-------------+------------+------+--------+--------------+----------------+ @@ -713,6 +713,9 @@ static bool itemdb_parse_dbrow(char** str, const char* source, int line, int scr safestrncpy(id->name, str[1], sizeof(id->name)); safestrncpy(id->jname, str[2], sizeof(id->jname)); + if(db == 1) + id->flag.db2 = 1; + id->type = atoi(str[3]); if (id->type == IT_DELAYCONSUME) { //Items that are consumed only after target confirmation @@ -900,8 +903,7 @@ static int itemdb_readdb(void) } str[21] = p; - - if (!itemdb_parse_dbrow(str, path, lines, 0)) + if (!itemdb_parse_dbrow(str, path, lines, 0, fi)) continue; count++; @@ -948,7 +950,7 @@ static int itemdb_read_sqldb(void) if( str[i] == NULL ) str[i] = dummy; // get rid of NULL columns } - if (!itemdb_parse_dbrow(str, item_db_name[fi], lines, SCRIPT_IGNORE_EXTERNAL_BRACKETS)) + if (!itemdb_parse_dbrow(str, item_db_name[fi], lines, SCRIPT_IGNORE_EXTERNAL_BRACKETS, fi)) continue; ++count; } @@ -1016,6 +1018,16 @@ static int itemdb_final_sub(DBKey key,void *data,va_list ap) return 0; } +static int itemdb_reload_sub(DBKey key,void *data,va_list ap) +{ + struct item_data *id = (struct item_data *)data; + + if( id != &dummy_item && id->flag.db2) + destroy_item_data(id, 1); + + return 0; +} + void itemdb_reload(void) { @@ -1023,11 +1035,13 @@ void itemdb_reload(void) for( i = 0; i < ARRAYLENGTH(itemdb_array); ++i ) if( itemdb_array[i] ) - destroy_item_data(itemdb_array[i], 1); - - itemdb_other->clear(itemdb_other, itemdb_final_sub); + if( itemdb_array[i]->flag.db2 ) + { + destroy_item_data(itemdb_array[i], 1); + memset(itemdb_array[i], 0, sizeof(struct item_data)); + } - memset(itemdb_array, 0, sizeof(itemdb_array)); + itemdb_other->clear(itemdb_other, itemdb_reload_sub); itemdb_read(); } |