summaryrefslogtreecommitdiff
path: root/src/common/HPM.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-09-26 04:11:41 +0200
committerHaru <haru@dotalux.com>2015-10-11 00:24:22 +0200
commit657e7f9c07bc1445ce785cd11772664a1848ea5a (patch)
treeb0b6ce19dfd5946fe6a0cf6c33eac78e357d4832 /src/common/HPM.h
parent70265291d62280c525adc317158e9f531e0147ff (diff)
downloadhercules-657e7f9c07bc1445ce785cd11772664a1848ea5a.tar.gz
hercules-657e7f9c07bc1445ce785cd11772664a1848ea5a.tar.bz2
hercules-657e7f9c07bc1445ce785cd11772664a1848ea5a.tar.xz
hercules-657e7f9c07bc1445ce785cd11772664a1848ea5a.zip
Cleanup of the HPluginData implementation (second part)
- Changed the hplugin_data_store's array into a VECTOR. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/HPM.h')
-rw-r--r--src/common/HPM.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/common/HPM.h b/src/common/HPM.h
index 1d13a178f..5420e5300 100644
--- a/src/common/HPM.h
+++ b/src/common/HPM.h
@@ -65,18 +65,24 @@ struct hpm_symbol {
void *ptr; ///< The symbol value
};
+/**
+ * A plugin custom data, to be injected in various interfaces and objects.
+ */
struct hplugin_data_entry {
- unsigned int pluginID;
- unsigned int type;
+ uint32 pluginID; ///< The owner plugin identifier.
+ uint32 classid; ///< The entry's object type, managed by the plugin (for plugins that need more than one entry).
struct {
- unsigned int free : 1;
+ unsigned int free : 1; ///< Whether the entry data should be automatically cleared by the HPM.
} flag;
- void *data;
+ void *data; ///< The entry data.
};
+/**
+ * A store for plugin custom data entries.
+ */
struct hplugin_data_store {
- struct hplugin_data_entry **array;
- unsigned int count;
+ enum HPluginDataTypes type; ///< The store type.
+ VECTOR_DECL(struct hplugin_data_entry *) entries; ///< The store entries.
};
struct HPluginPacket {
@@ -144,11 +150,11 @@ struct HPM_interface {
void (*datacheck_init) (const struct s_HPMDataCheck *src, unsigned int length, int version);
void (*datacheck_final) (void);
- struct hplugin_data_store *(*data_store_create) (void);
- void (*data_store_destroy) (struct hplugin_data_store *store);
- bool (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **store);
+ void (*data_store_create) (struct hplugin_data_store **storeptr, enum HPluginDataTypes type);
+ void (*data_store_destroy) (struct hplugin_data_store **storeptr);
+ bool (*data_store_validate) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize);
/* for server-specific HPData e.g. map_session_data */
- bool (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **store);
+ bool (*data_store_validate_sub) (enum HPluginDataTypes type, struct hplugin_data_store **storeptr, bool initialize);
};
CMDLINEARG(loadplugin);