summaryrefslogtreecommitdiff
path: root/src/map/itemdb.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-12-20 23:42:37 +0100
committerHaruna <haru@dotalux.com>2014-12-20 23:42:37 +0100
commit1134e030744e67bca61f52dc97075f33932f7a38 (patch)
tree3c5f077c6537f7e165039d3bf68d8052253b7dc2 /src/map/itemdb.c
parentc4456ddbebccaca51ab040c60e3c586ed2cc0a10 (diff)
parent2c6fd58d633e4139a6f0f3b4bb0262e64fc957e2 (diff)
downloadhercules-1134e030744e67bca61f52dc97075f33932f7a38.tar.gz
hercules-1134e030744e67bca61f52dc97075f33932f7a38.tar.bz2
hercules-1134e030744e67bca61f52dc97075f33932f7a38.tar.xz
hercules-1134e030744e67bca61f52dc97075f33932f7a38.zip
Merge pull request #416 from 4144/plugext
Extend plugins support in item_data, mob_db, mob_data
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r--src/map/itemdb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c
index 545ce9ba0..cd4465468 100644
--- a/src/map/itemdb.c
+++ b/src/map/itemdb.c
@@ -16,6 +16,7 @@
#include "mob.h" // MAX_MOB_DB
#include "pc.h" // W_MUSICAL, W_WHIP
#include "script.h" // item script processing
+#include "../common/HPM.h"
#include "../common/conf.h"
#include "../common/malloc.h"
#include "../common/nullpo.h"
@@ -1501,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.
@@ -1936,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] ) {
@@ -2069,6 +2076,7 @@ bool itemdb_is_item_usable(struct item_data *item)
/// Destroys the item_data.
void destroy_item_data(struct item_data* self, int free_self)
{
+ int v;
if( self == NULL )
return;
// free scripts
@@ -2080,6 +2088,14 @@ void destroy_item_data(struct item_data* self, int free_self)
script->free_code(self->unequip_script);
if( self->combos )
aFree(self->combos);
+ for (v = 0; v < self->hdatac; v++ ) {
+ if (self->hdata[v]->flag.free ) {
+ aFree(self->hdata[v]->data);
+ }
+ aFree(self->hdata[v]);
+ }
+ if (self->hdata)
+ aFree(self->hdata);
#if defined(DEBUG)
// trash item
memset(self, 0xDD, sizeof(struct item_data));
@@ -2335,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;