diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-18 00:29:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-21 01:38:16 +0300 |
commit | a75f608ed23e2d6ac06582abb833c2a874cd7815 (patch) | |
tree | 106cdf1932ed90e0745ebafcbbe10e3377d45c10 /src | |
parent | 575b83e553b1b02a05a6cf9732d6b761b522cd74 (diff) | |
download | hercules-a75f608ed23e2d6ac06582abb833c2a874cd7815.tar.gz hercules-a75f608ed23e2d6ac06582abb833c2a874cd7815.tar.bz2 hercules-a75f608ed23e2d6ac06582abb833c2a874cd7815.tar.xz hercules-a75f608ed23e2d6ac06582abb833c2a874cd7815.zip |
Add function for reading custom itemdb fields.
This functions called after reading normal fields and after
adding item to itemdb.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/itemdb.c | 7 | ||||
-rw-r--r-- | src/map/itemdb.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 9bb34f024..cd4465468 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1502,6 +1502,11 @@ int itemdb_validate_entry(struct item_data *entry, int n, const char *source) { return item->nameid; } +void itemdb_readdb_additional_fields(int itemid, config_setting_t *it, int n, const char *source) +{ + // do nothing. plugins can do own work +} + /** * Processes one itemdb entry from the sql backend, loading and inserting it * into the item database. @@ -1937,6 +1942,7 @@ int itemdb_readdb_libconfig(const char *filename) { if( !nameid ) continue; + itemdb->readdb_additional_fields(nameid, it, i - 1, filename); count++; if( duplicate[nameid] ) { @@ -2345,6 +2351,7 @@ void itemdb_defaults(void) { itemdb->read_combos = itemdb_read_combos; itemdb->gendercheck = itemdb_gendercheck; itemdb->validate_entry = itemdb_validate_entry; + itemdb->readdb_additional_fields = itemdb_readdb_additional_fields; itemdb->readdb_sql_sub = itemdb_readdb_sql_sub; itemdb->readdb_libconfig_sub = itemdb_readdb_libconfig_sub; itemdb->readdb_libconfig = itemdb_readdb_libconfig; diff --git a/src/map/itemdb.h b/src/map/itemdb.h index f65345cb9..9a72c64ac 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -604,6 +604,7 @@ struct itemdb_interface { void (*read_combos) (); int (*gendercheck) (struct item_data *id); int (*validate_entry) (struct item_data *entry, int n, const char *source); + void (*readdb_additional_fields) (int itemid, config_setting_t *it, int n, const char *source); int (*readdb_sql_sub) (Sql *handle, int n, const char *source); int (*readdb_libconfig_sub) (config_setting_t *it, int n, const char *source); int (*readdb_libconfig) (const char *filename); |