summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-01-19 02:58:36 -0200
committershennetsind <ind@henn.et>2014-01-19 02:58:36 -0200
commitacc992ac2838f6380ebf2b2f8a514e86c2b750d9 (patch)
tree9d06366b015de60c71280f92c48fadb024e04a0f /src/common
parentc32a22c52b75ae8c3bc2064110318f4ad1d6954a (diff)
downloadhercules-acc992ac2838f6380ebf2b2f8a514e86c2b750d9.tar.gz
hercules-acc992ac2838f6380ebf2b2f8a514e86c2b750d9.tar.bz2
hercules-acc992ac2838f6380ebf2b2f8a514e86c2b750d9.tar.xz
hercules-acc992ac2838f6380ebf2b2f8a514e86c2b750d9.zip
HPM Custom Data Struct Expansion: map/instance/party/guild
As requested by the community in http://hercules.ws/board/topic/3832-hpm-custom-data-struct-for-instance-data-guild-data-and-party-data/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/HPM.c16
-rw-r--r--src/common/HPM.h2
-rw-r--r--src/common/HPMi.h20
-rw-r--r--src/common/mmo.h12
4 files changed, 39 insertions, 11 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index cb70ddcd7..1edf24901 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -316,19 +316,21 @@ CPCMD(plugins) {
void hplugins_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr) {
/* record address */
switch( type ) {
+ /* core-handled */
case HPDT_SESSION:
ret->HPDataSRCPtr = (void**)(&((struct socket_data *)ptr)->hdata);
ret->hdatac = &((struct socket_data *)ptr)->hdatac;
break;
/* goes to sub */
- case HPDT_MSD:
- case HPDT_NPCD:
- if( HPM->grabHPDataSub )
- HPM->grabHPDataSub(ret,type,ptr);
- else
- ShowError("HPM:grabHPData failed, type %d needs sub-handler!\n",type);
- break;
default:
+ if( HPM->grabHPDataSub ) {
+ if( HPM->grabHPDataSub(ret,type,ptr) )
+ return;
+ else {
+ ShowError("HPM:HPM:grabHPData failed, unknown type %d!\n",type);
+ }
+ } else
+ ShowError("HPM:grabHPData failed, type %d needs sub-handler!\n",type);
ret->HPDataSRCPtr = NULL;
ret->hdatac = NULL;
return;
diff --git a/src/common/HPM.h b/src/common/HPM.h
index 1f2ba4648..393f8f819 100644
--- a/src/common/HPM.h
+++ b/src/common/HPM.h
@@ -143,7 +143,7 @@ struct HPM_interface {
int (*arg_db_clear_sub) (DBKey key, DBData *data, va_list args);
void (*grabHPData) (struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr);
/* for server-specific HPData e.g. map_session_data */
- void (*grabHPDataSub) (struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr);
+ bool (*grabHPDataSub) (struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr);
/* for custom config parsing */
bool (*parseConf) (const char *w1, const char *w2, enum HPluginConfType point);
} HPM_s;
diff --git a/src/common/HPMi.h b/src/common/HPMi.h
index 78a3a9ab5..fdb6ccf52 100644
--- a/src/common/HPMi.h
+++ b/src/common/HPMi.h
@@ -82,6 +82,10 @@ enum HPluginDataTypes {
HPDT_SESSION,
HPDT_MSD,
HPDT_NPCD,
+ HPDT_MAP,
+ HPDT_INSTANCE,
+ HPDT_GUILD,
+ HPDT_PARTY,
};
/* used in macros and conf storage */
@@ -111,6 +115,22 @@ enum HPluginConfType {
#define addToNPCD(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_NPCD,HPMi->pid,(ptr),(data),(index),(autofree)))
#define getFromNPCD(ptr,index) (HPMi->getFromHPData(HPDT_NPCD,HPMi->pid,(ptr),(index)))
#define removeFromNPCD(ptr,index) (HPMi->removeFromHPData(HPDT_NPCD,HPMi->pid,(ptr),(index)))
+/* map_data */
+#define addToMAPD(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_MAP,HPMi->pid,(ptr),(data),(index),(autofree)))
+#define getFromMAPD(ptr,index) (HPMi->getFromHPData(HPDT_MAP,HPMi->pid,(ptr),(index)))
+#define removeFromMAPD(ptr,index) (HPMi->removeFromHPData(HPDT_MAP,HPMi->pid,(ptr),(index)))
+/* party_data */
+#define addToPAD(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_PARTY,HPMi->pid,(ptr),(data),(index),(autofree)))
+#define getFromPAD(ptr,index) (HPMi->getFromHPData(HPDT_PARTY,HPMi->pid,(ptr),(index)))
+#define removeFromPAD(ptr,index) (HPMi->removeFromHPData(HPDT_PARTY,HPMi->pid,(ptr),(index)))
+/* guild */
+#define addToGLD(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_GUILD,HPMi->pid,(ptr),(data),(index),(autofree)))
+#define getFromGLD(ptr,index) (HPMi->getFromHPData(HPDT_GUILD,HPMi->pid,(ptr),(index)))
+#define removeFromGLD(ptr,index) (HPMi->removeFromHPData(HPDT_GUILD,HPMi->pid,(ptr),(index)))
+/* instance_data */
+#define addToINSTD(ptr,data,index,autofree) (HPMi->addToHPData(HPDT_INSTANCE,HPMi->pid,(ptr),(data),(index),(autofree)))
+#define getFromINSTD(ptr,index) (HPMi->getFromHPData(HPDT_INSTANCE,HPMi->pid,(ptr),(index)))
+#define removeFromINSTD(ptr,index) (HPMi->removeFromHPData(HPDT_INSTANCE,HPMi->pid,(ptr),(index)))
/* HPMi->addCommand */
#define addAtcommand(cname,funcname) \
diff --git a/src/common/mmo.h b/src/common/mmo.h
index 7350de443..670c2f7f7 100644
--- a/src/common/mmo.h
+++ b/src/common/mmo.h
@@ -178,6 +178,8 @@
#define EL_CLASS_BASE 2114
#define EL_CLASS_MAX (EL_CLASS_BASE+MAX_ELEMENTAL_CLASS-1)
+struct HPluginData;
+
enum item_types {
IT_HEALING = 0,
IT_UNKNOWN, //1
@@ -498,7 +500,7 @@ struct party {
unsigned char count; //Count of online characters.
unsigned exp : 1,
item : 2; //&1: Party-Share (round-robin), &2: pickup style: shared.
- struct party_member member[MAX_PARTY];
+ struct party_member member[MAX_PARTY];
};
struct map_session_data;
@@ -553,13 +555,17 @@ struct guild {
struct guild_expulsion expulsion[MAX_GUILDEXPULSION];
struct guild_skill skill[MAX_GUILDSKILL];
- /* TODO: still used for something?|: */
- unsigned short save_flag; // for TXT saving
+ /* used on char.c to state what kind of data is being saved/processed */
+ unsigned short save_flag;
short *instance;
unsigned short instances;
struct hChSysCh *channel;
+
+ /* HPM Custom Struct */
+ struct HPluginData **hdata;
+ unsigned int hdatac;
};
struct guild_castle {