summaryrefslogtreecommitdiff
path: root/src/map/HPMmap.c
diff options
context:
space:
mode:
authorHaruna <haru@dotalux.com>2014-10-31 01:18:40 +0100
committerHaruna <haru@dotalux.com>2014-10-31 01:18:40 +0100
commit1d0452110f4b02f6d771c61d5c3a944f82b155f3 (patch)
treeb36963aeb2f4924e49b5f4e80c270bf4275fb4c4 /src/map/HPMmap.c
parent72e18cdf9b612c476dd9ab2d45394c5e882e7dd1 (diff)
parent60becfc70e65ba7920079f990bfaa11851369f0c (diff)
downloadhercules-1d0452110f4b02f6d771c61d5c3a944f82b155f3.tar.gz
hercules-1d0452110f4b02f6d771c61d5c3a944f82b155f3.tar.bz2
hercules-1d0452110f4b02f6d771c61d5c3a944f82b155f3.tar.xz
hercules-1d0452110f4b02f6d771c61d5c3a944f82b155f3.zip
Merge pull request #378 from HerculesWS/hpmupdates
Char and login server preliminary support for the HPM system
Diffstat (limited to 'src/map/HPMmap.c')
-rw-r--r--src/map/HPMmap.c44
1 files changed, 4 insertions, 40 deletions
diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c
index cb8c979c6..a0701ae45 100644
--- a/src/map/HPMmap.c
+++ b/src/map/HPMmap.c
@@ -74,11 +74,6 @@ struct HPM_atcommand_list {
struct HPM_atcommand_list *atcommand_list = NULL;
unsigned int atcommand_list_items = 0;
-/**
- * (char*) data name -> (unsigned int) HPMDataCheck[] index
- **/
-DBMap *datacheck_db;
-
bool HPM_map_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTypes type, void *ptr) {
/* record address */
switch( type ) {
@@ -147,29 +142,6 @@ void HPM_map_atcommands(void) {
}
/**
- * Called by HPM->DataCheck on a plugins incoming data, ensures data structs in use are matching!
- **/
-bool HPM_map_DataCheck (struct s_HPMDataCheck *src, unsigned int size, char *name) {
- unsigned int i, j;
-
- for(i = 0; i < size; i++) {
-
- if( !strdb_exists(datacheck_db, src[i].name) ) {
- ShowError("HPMDataCheck:%s: '%s' was not found\n",name,src[i].name);
- return false;
- } else {
- j = strdb_uiget(datacheck_db, src[i].name);/* not double lookup; exists sets cache to found data */
- if( src[i].size != HPMDataCheck[j].size ) {
- ShowWarning("HPMDataCheck:%s: '%s' size mismatch %u != %u\n",name,src[i].name,src[i].size,HPMDataCheck[j].size);
- return false;
- }
- }
- }
-
- return true;
-}
-
-/**
* Adds a new group permission to the HPM-provided list
**/
void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned int *mask) {
@@ -183,17 +155,9 @@ void HPM_map_add_group_permission(unsigned int pluginID, char *name, unsigned in
}
void HPM_map_do_init(void) {
- unsigned int i;
-
- /**
- * Populates datacheck_db for easy lookup later on
- **/
- datacheck_db = strdb_alloc(DB_OPT_BASE,0);
-
- for(i = 0; i < HPMDataCheckLen; i++) {
- strdb_uiput(datacheck_db, HPMDataCheck[i].name, i);
- }
-
+ HPM->load_sub = HPM_map_plugin_load_sub;
+ HPM->grabHPDataSub = HPM_map_grabHPData;
+ HPM->datacheck_init(HPMDataCheck, HPMDataCheckLen, HPMDataCheckVer);
}
void HPM_map_do_final(void) {
@@ -211,5 +175,5 @@ void HPM_map_do_final(void) {
if( pcg->HPMpermissions )
aFree(pcg->HPMpermissions);
- db_destroy(datacheck_db);
+ HPM->datacheck_final();
}