diff options
author | Haru <haru@dotalux.com> | 2015-08-11 02:16:59 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2015-08-15 00:51:45 +0200 |
commit | 5efc9f173f6905da39f3037c278e0e880e82ca35 (patch) | |
tree | 817b3d13d20a3fe99fe4d7465b22148b9ad66dd3 | |
parent | 7c52605cabb4f5447055344733d69555c1948956 (diff) | |
download | hercules-5efc9f173f6905da39f3037c278e0e880e82ca35.tar.gz hercules-5efc9f173f6905da39f3037c278e0e880e82ca35.tar.bz2 hercules-5efc9f173f6905da39f3037c278e0e880e82ca35.tar.xz hercules-5efc9f173f6905da39f3037c278e0e880e82ca35.zip |
Removed some unnecessary shared symbols, already present in interfaces
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | src/common/HPM.c | 506 | ||||
-rw-r--r-- | src/common/HPMi.h | 34 | ||||
-rw-r--r-- | src/map/HPMmap.c | 6 | ||||
-rw-r--r-- | src/map/map.c | 4 |
4 files changed, 278 insertions, 272 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 8963630b1..dcca6ae4c 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -96,6 +96,250 @@ struct hplugin *hplugin_create(void) { HPM->plugins[HPM->plugin_count - 1]->filename = NULL; return HPM->plugins[HPM->plugin_count - 1]; } + +bool hplugins_addpacket(unsigned short cmd, unsigned short length, void (*receive) (int fd), unsigned int point,unsigned int pluginID) { + struct HPluginPacket *packet; + unsigned int i; + + if( point >= hpPHP_MAX ) { + ShowError("HPM->addPacket:%s: unknown point '%u' specified for packet 0x%04x (len %d)\n",HPM->pid2name(pluginID),point,cmd,length); + return false; + } + + for(i = 0; i < HPM->packetsc[point]; i++) { + if( HPM->packets[point][i].cmd == cmd ) { + ShowError("HPM->addPacket:%s: can't add packet 0x%04x, already in use by '%s'!",HPM->pid2name(pluginID),cmd,HPM->pid2name(HPM->packets[point][i].pluginID)); + return false; + } + } + + RECREATE(HPM->packets[point], struct HPluginPacket, ++HPM->packetsc[point]); + packet = &HPM->packets[point][HPM->packetsc[point] - 1]; + + packet->pluginID = pluginID; + packet->cmd = cmd; + packet->len = length; + packet->receive = receive; + + return true; +} + +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 */ + default: + if (HPM->grabHPDataSub) { + if (HPM->grabHPDataSub(ret,type,ptr)) + return; + 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; + } +} + +void hplugins_addToHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, void *data, unsigned int index, bool autofree) +{ + struct HPluginData *HPData, **HPDataSRC; + struct HPDataOperationStorage action; + unsigned int i, max; + + HPM->grabHPData(&action,type,ptr); + + if (action.hdatac == NULL) { /* woo it failed! */ + ShowError("HPM:addToHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); + return; + } + + /* flag */ + HPDataSRC = *(action.HPDataSRCPtr); + max = *(action.hdatac); + + /* duplicate check */ + for (i = 0; i < max; i++) { + if (HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index) { + ShowError("HPM:addToHPData:%s: error! attempting to insert duplicate struct of id %u and index %u\n",HPM->pid2name(pluginID),pluginID,index); + return; + } + } + + /* HPluginData is always same size, probably better to use the ERS (with reasonable chunk size e.g. 10/25/50) */ + CREATE(HPData, struct HPluginData, 1); + + /* input */ + HPData->pluginID = pluginID; + HPData->type = index; + HPData->flag.free = autofree ? 1 : 0; + HPData->data = data; + + /* resize */ + *(action.hdatac) += 1; + RECREATE(*(action.HPDataSRCPtr),struct HPluginData *,*(action.hdatac)); + + /* RECREATE modified the address */ + HPDataSRC = *(action.HPDataSRCPtr); + HPDataSRC[*(action.hdatac) - 1] = HPData; +} + +void *hplugins_getFromHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, unsigned int index) +{ + struct HPDataOperationStorage action; + struct HPluginData **HPDataSRC; + unsigned int i, max; + + HPM->grabHPData(&action,type,ptr); + + if (action.hdatac == NULL) { /* woo it failed! */ + ShowError("HPM:getFromHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); + return NULL; + } + + /* flag */ + HPDataSRC = *(action.HPDataSRCPtr); + max = *(action.hdatac); + + for (i = 0; i < max; i++) { + if (HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index) + return HPDataSRC[i]->data; + } + + return NULL; +} + +void hplugins_removeFromHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, unsigned int index) +{ + struct HPDataOperationStorage action; + struct HPluginData **HPDataSRC; + unsigned int i, max; + + HPM->grabHPData(&action,type,ptr); + + if (action.hdatac == NULL) { /* woo it failed! */ + ShowError("HPM:removeFromHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); + return; + } + + /* flag */ + HPDataSRC = *(action.HPDataSRCPtr); + max = *(action.hdatac); + + for (i = 0; i < max; i++) { + if (HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index) + break; + } + + if (i != max) { + unsigned int cursor; + + aFree(HPDataSRC[i]->data);/* when its removed we delete it regardless of autofree */ + aFree(HPDataSRC[i]); + HPDataSRC[i] = NULL; + + for (i = 0, cursor = 0; i < max; i++) { + if (HPDataSRC[i] == NULL) + continue; + if (i != cursor) + HPDataSRC[cursor] = HPDataSRC[i]; + cursor++; + } + *(action.hdatac) = cursor; + } +} + +/* TODO: add ability for tracking using pID for the upcoming runtime load/unload support. */ +bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) +{ + if (!HPM->hooking) { + ShowError("HPM:AddHook Fail! '%s' tried to hook to '%s' but HPMHooking is disabled!\n",HPM->pid2name(pID),target); + return false; + } + /* search if target is a known hook point within 'common' */ + /* if not check if a sub-hooking list is available (from the server) and run it by */ + if (HPM->addhook_sub && HPM->addhook_sub(type,target,hook,pID)) + return true; + + ShowError("HPM:AddHook: unknown Hooking Point '%s'!\n",target); + + return false; +} + +void HPM_HookStop(const char *func, unsigned int pID) +{ + /* track? */ + HPM->force_return = true; +} + +bool HPM_HookStopped (void) +{ + return HPM->force_return; +} + +/** + * Adds a plugin-defined command-line argument. + * + * @param pluginID the current plugin's ID. + * @param name the command line argument's name, including the leading '--'. + * @param has_param whether the command line argument expects to be followed by a value. + * @param func the triggered function. + * @param help the help string to be displayed by '--help', if any. + * @return the success status. + */ +bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help) +{ + int i; + + if (!name || strlen(name) < 3 || name[0] != '-' || name[1] != '-') { + ShowError("HPM:add_arg:%s invalid argument name: arguments must begin with '--' (from %s)\n", name, HPM->pid2name(pluginID)); + return false; + } + + ARR_FIND(0, cmdline->args_data_count, i, strcmp(cmdline->args_data[i].name, name) == 0); + + if (i < cmdline->args_data_count) { + ShowError("HPM:add_arg:%s duplicate! (from %s)\n",name,HPM->pid2name(pluginID)); + return false; + } + + return cmdline->arg_add(pluginID, name, '\0', func, help, has_param ? CMDLINE_OPT_PARAM : CMDLINE_OPT_NORMAL); +} + +bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *name, void (*func) (const char *val)) +{ + struct HPConfListenStorage *conf; + unsigned int i; + + if (type >= HPCT_MAX) { + ShowError("HPM->addConf:%s: unknown point '%u' specified for config '%s'\n",HPM->pid2name(pluginID),type,name); + return false; + } + + for (i = 0; i < HPM->confsc[type]; i++) { + if (!strcmpi(name,HPM->confs[type][i].key)) { + ShowError("HPM->addConf:%s: duplicate '%s', already in use by '%s'!",HPM->pid2name(pluginID),name,HPM->pid2name(HPM->confs[type][i].pluginID)); + return false; + } + } + + RECREATE(HPM->confs[type], struct HPConfListenStorage, ++HPM->confsc[type]); + conf = &HPM->confs[type][HPM->confsc[type] - 1]; + + conf->pluginID = pluginID; + safestrncpy(conf->key, name, HPM_ADDCONF_LENGTH); + conf->func = func; + + return true; +} + struct hplugin *hplugin_load(const char* filename) { struct hplugin *plugin; struct hplugin_info *info; @@ -212,16 +456,18 @@ struct hplugin *hplugin_load(const char* filename) { /* id */ plugin->hpi->pid = plugin->idx; /* core */ - plugin->hpi->addCPCommand = HPM->import_symbol("addCPCommand",plugin->idx); - plugin->hpi->addPacket = HPM->import_symbol("addPacket",plugin->idx); - plugin->hpi->addToHPData = HPM->import_symbol("addToHPData",plugin->idx); - plugin->hpi->getFromHPData = HPM->import_symbol("getFromHPData",plugin->idx); - plugin->hpi->removeFromHPData = HPM->import_symbol("removeFromHPData",plugin->idx); - plugin->hpi->AddHook = HPM->import_symbol("AddHook",plugin->idx); - plugin->hpi->HookStop = HPM->import_symbol("HookStop",plugin->idx); - plugin->hpi->HookStopped = HPM->import_symbol("HookStopped",plugin->idx); - plugin->hpi->addArg = HPM->import_symbol("addArg",plugin->idx); - plugin->hpi->addConf = HPM->import_symbol("addConf",plugin->idx); +#ifdef CONSOLE_INPUT + plugin->hpi->addCPCommand = console->input->addCommand; +#endif // CONSOLE_INPUT + plugin->hpi->addPacket = hplugins_addpacket; + plugin->hpi->addToHPData = hplugins_addToHPData; + plugin->hpi->getFromHPData = hplugins_getFromHPData; + plugin->hpi->removeFromHPData = hplugins_removeFromHPData; + plugin->hpi->AddHook = HPM_AddHook; + plugin->hpi->HookStop = HPM_HookStop; + plugin->hpi->HookStopped = HPM_HookStopped; + plugin->hpi->addArg = hpm_add_arg; + plugin->hpi->addConf = hplugins_addconf; /* server specific */ if( HPM->load_sub ) HPM->load_sub(plugin); @@ -356,160 +602,7 @@ 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 */ - 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; - } -} -void hplugins_addToHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, void *data, unsigned int index, bool autofree) { - struct HPluginData *HPData, **HPDataSRC; - struct HPDataOperationStorage action; - unsigned int i, max; - - HPM->grabHPData(&action,type,ptr); - - if( action.hdatac == NULL ) { /* woo it failed! */ - ShowError("HPM:addToHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); - return; - } - - /* flag */ - HPDataSRC = *(action.HPDataSRCPtr); - max = *(action.hdatac); - - /* duplicate check */ - for(i = 0; i < max; i++) { - if( HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index ) { - ShowError("HPM:addToHPData:%s: error! attempting to insert duplicate struct of id %u and index %u\n",HPM->pid2name(pluginID),pluginID,index); - return; - } - } - - /* HPluginData is always same size, probably better to use the ERS (with reasonable chunk size e.g. 10/25/50) */ - CREATE(HPData, struct HPluginData, 1); - - /* input */ - HPData->pluginID = pluginID; - HPData->type = index; - HPData->flag.free = autofree ? 1 : 0; - HPData->data = data; - - /* resize */ - *(action.hdatac) += 1; - RECREATE(*(action.HPDataSRCPtr),struct HPluginData *,*(action.hdatac)); - - /* RECREATE modified the address */ - HPDataSRC = *(action.HPDataSRCPtr); - HPDataSRC[*(action.hdatac) - 1] = HPData; -} - -void *hplugins_getFromHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, unsigned int index) { - struct HPDataOperationStorage action; - struct HPluginData **HPDataSRC; - unsigned int i, max; - - HPM->grabHPData(&action,type,ptr); - - if( action.hdatac == NULL ) { /* woo it failed! */ - ShowError("HPM:getFromHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); - return NULL; - } - - /* flag */ - HPDataSRC = *(action.HPDataSRCPtr); - max = *(action.hdatac); - - for(i = 0; i < max; i++) { - if( HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index ) - return HPDataSRC[i]->data; - } - - return NULL; -} -void hplugins_removeFromHPData(enum HPluginDataTypes type, unsigned int pluginID, void *ptr, unsigned int index) { - struct HPDataOperationStorage action; - struct HPluginData **HPDataSRC; - unsigned int i, max; - - HPM->grabHPData(&action,type,ptr); - - if( action.hdatac == NULL ) { /* woo it failed! */ - ShowError("HPM:removeFromHPData:%s: failed, type %d (%u|%u)\n",HPM->pid2name(pluginID),type,pluginID,index); - return; - } - - /* flag */ - HPDataSRC = *(action.HPDataSRCPtr); - max = *(action.hdatac); - - for(i = 0; i < max; i++) { - if( HPDataSRC[i]->pluginID == pluginID && HPDataSRC[i]->type == index ) - break; - } - - if( i != max ) { - unsigned int cursor; - - aFree(HPDataSRC[i]->data);/* when its removed we delete it regardless of autofree */ - aFree(HPDataSRC[i]); - HPDataSRC[i] = NULL; - - for(i = 0, cursor = 0; i < max; i++) { - if( HPDataSRC[i] == NULL ) - continue; - if( i != cursor ) - HPDataSRC[cursor] = HPDataSRC[i]; - cursor++; - } - *(action.hdatac) = cursor; - } -} - -bool hplugins_addpacket(unsigned short cmd, short length,void (*receive) (int fd),unsigned int point,unsigned int pluginID) { - struct HPluginPacket *packet; - unsigned int i; - - if( point >= hpPHP_MAX ) { - ShowError("HPM->addPacket:%s: unknown point '%u' specified for packet 0x%04x (len %d)\n",HPM->pid2name(pluginID),point,cmd,length); - return false; - } - - for(i = 0; i < HPM->packetsc[point]; i++) { - if( HPM->packets[point][i].cmd == cmd ) { - ShowError("HPM->addPacket:%s: can't add packet 0x%04x, already in use by '%s'!",HPM->pid2name(pluginID),cmd,HPM->pid2name(HPM->packets[point][i].pluginID)); - return false; - } - } - - RECREATE(HPM->packets[point], struct HPluginPacket, ++HPM->packetsc[point]); - packet = &HPM->packets[point][HPM->packetsc[point] - 1]; - - packet->pluginID = pluginID; - packet->cmd = cmd; - packet->len = length; - packet->receive = receive; - - return true; -} /* 0 = unknown 1 = OK @@ -586,80 +679,7 @@ void* HPM_reallocz(void *p, size_t size, const char *file, int line, const char char* HPM_astrdup(const char *p, const char *file, int line, const char *func) { return iMalloc->astrdup(p,HPM_file2ptr(file),line,func); } -/* TODO: add ability for tracking using pID for the upcoming runtime load/unload support. */ -bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsigned int pID) { - if( !HPM->hooking ) { - ShowError("HPM:AddHook Fail! '%s' tried to hook to '%s' but HPMHooking is disabled!\n",HPM->pid2name(pID),target); - return false; - } - /* search if target is a known hook point within 'common' */ - /* if not check if a sub-hooking list is available (from the server) and run it by */ - if( HPM->addhook_sub && HPM->addhook_sub(type,target,hook,pID) ) - return true; - ShowError("HPM:AddHook: unknown Hooking Point '%s'!\n",target); - - return false; -} -void HPM_HookStop (const char *func, unsigned int pID) { - /* track? */ - HPM->force_return = true; -} -bool HPM_HookStopped (void) { - return HPM->force_return; -} -/** - * Adds a plugin-defined command-line argument. - * - * @param pluginID the current plugin's ID. - * @param name the command line argument's name, including the leading '--'. - * @param has_param whether the command line argument expects to be followed by a value. - * @param func the triggered function. - * @param help the help string to be displayed by '--help', if any. - * @return the success status. - */ -bool hpm_add_arg(unsigned int pluginID, char *name, bool has_param, CmdlineExecFunc func, const char *help) { - int i; - - if (!name || strlen(name) < 3 || name[0] != '-' || name[1] != '-') { - ShowError("HPM:add_arg:%s invalid argument name: arguments must begin with '--' (from %s)\n", name, HPM->pid2name(pluginID)); - return false; - } - - ARR_FIND(0, cmdline->args_data_count, i, strcmp(cmdline->args_data[i].name, name) == 0); - - if (i < cmdline->args_data_count) { - ShowError("HPM:add_arg:%s duplicate! (from %s)\n",name,HPM->pid2name(pluginID)); - return false; - } - - return cmdline->arg_add(pluginID, name, '\0', func, help, has_param ? CMDLINE_OPT_PARAM : CMDLINE_OPT_NORMAL); -} -bool hplugins_addconf(unsigned int pluginID, enum HPluginConfType type, char *name, void (*func) (const char *val)) { - struct HPConfListenStorage *conf; - unsigned int i; - - if( type >= HPCT_MAX ) { - ShowError("HPM->addConf:%s: unknown point '%u' specified for config '%s'\n",HPM->pid2name(pluginID),type,name); - return false; - } - - for(i = 0; i < HPM->confsc[type]; i++) { - if( !strcmpi(name,HPM->confs[type][i].key) ) { - ShowError("HPM->addConf:%s: duplicate '%s', already in use by '%s'!",HPM->pid2name(pluginID),name,HPM->pid2name(HPM->confs[type][i].pluginID)); - return false; - } - } - - RECREATE(HPM->confs[type], struct HPConfListenStorage, ++HPM->confsc[type]); - conf = &HPM->confs[type][HPM->confsc[type] - 1]; - - conf->pluginID = pluginID; - safestrncpy(conf->key, name, HPM_ADDCONF_LENGTH); - conf->func = func; - - return true; -} bool hplugins_parse_conf(const char *w1, const char *w2, enum HPluginConfType point) { unsigned int i; @@ -729,20 +749,6 @@ void HPM_datacheck_final(void) { } void hplugins_share_defaults(void) { - /* console */ -#ifdef CONSOLE_INPUT - HPM->share(console->input->addCommand,"addCPCommand"); -#endif - /* our own */ - HPM->share(hplugins_addpacket,"addPacket"); - HPM->share(hplugins_addToHPData,"addToHPData"); - HPM->share(hplugins_getFromHPData,"getFromHPData"); - HPM->share(hplugins_removeFromHPData,"removeFromHPData"); - HPM->share(HPM_AddHook,"AddHook"); - HPM->share(HPM_HookStop,"HookStop"); - HPM->share(HPM_HookStopped,"HookStopped"); - HPM->share(hpm_add_arg,"addArg"); - HPM->share(hplugins_addconf,"addConf"); /* core */ HPM->share(core,"core"); HPM->share(HPMiMalloc, "iMalloc"); diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 5f677cce3..6f97659f9 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -139,33 +139,37 @@ enum HPluginConfType { #define getFromBGDATA(ptr,index) (HPMi->getFromHPData(HPDT_BGDATA,HPMi->pid,(ptr),(index))) #define removeFromBGDATA(ptr,index) (HPMi->removeFromHPData(HPDT_BGDATA,HPMi->pid,(ptr),(index))) -/* HPMi->addCommand */ -#define addAtcommand(cname,funcname) \ - if ( HPMi->addCommand != NULL ) { \ +/// HPMi->addCommand +#define addAtcommand(cname,funcname) do { \ + if (HPMi->addCommand != NULL) { \ HPMi->addCommand(cname,atcommand_ ## funcname); \ } else { \ ShowWarning("HPM (%s):addAtcommand(\"%s\",%s) failed, addCommand sub is NULL!\n",pinfo.name,cname,# funcname);\ - } -/* HPMi->addScript */ -#define addScriptCommand(cname,scinfo,funcname) \ - if ( HPMi->addScript != NULL ) { \ + } \ +} while(0) +/// HPMi->addScript +#define addScriptCommand(cname,scinfo,funcname) do { \ + if (HPMi->addScript != NULL) { \ HPMi->addScript(cname,scinfo,buildin_ ## funcname, false); \ } else { \ ShowWarning("HPM (%s):addScriptCommand(\"%s\",\"%s\",%s) failed, addScript sub is NULL!\n",pinfo.name,cname,scinfo,# funcname);\ - } -#define addScriptCommandDeprecated(cname,scinfo,funcname) \ - if ( HPMi->addScript != NULL ) { \ + } \ +} while(0) +#define addScriptCommandDeprecated(cname,scinfo,funcname) do { \ + if (HPMi->addScript != NULL) { \ HPMi->addScript(cname,scinfo,buildin_ ## funcname, true); \ } else { \ ShowWarning("HPM (%s):addScriptCommandDeprecated(\"%s\",\"%s\",%s) failed, addScript sub is NULL!\n",pinfo.name,cname,scinfo,# funcname);\ - } -/* HPMi->addCPCommand */ -#define addCPCommand(cname,funcname) \ - if ( HPMi->addCPCommand != NULL ) { \ + } \ +} while(0) +/// HPMi->addCPCommand +#define addCPCommand(cname,funcname) do { \ + if (HPMi->addCPCommand != NULL) { \ HPMi->addCPCommand(cname,console_parse_ ## funcname); \ } else { \ ShowWarning("HPM (%s):addCPCommand(\"%s\",%s) failed, addCPCommand sub is NULL!\n",pinfo.name,cname,# funcname);\ - } + } \ +} while(0) /* HPMi->addPacket */ #define addPacket(cmd,len,receive,point) HPMi->addPacket(cmd,len,receive,point,HPMi->pid) /* HPMi->addBattleConf */ diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 9029a6a78..a974f60ce 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -136,9 +136,9 @@ bool HPM_map_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataType void HPM_map_plugin_load_sub(struct hplugin *plugin) { plugin->hpi->sql_handle = map->mysql_handle; - plugin->hpi->addCommand = HPM->import_symbol("addCommand",plugin->idx); - plugin->hpi->addScript = HPM->import_symbol("addScript",plugin->idx); - plugin->hpi->addPCGPermission = HPM->import_symbol("addGroupPermission",plugin->idx); + plugin->hpi->addCommand = atcommand->create; + plugin->hpi->addScript = script->addScript; + plugin->hpi->addPCGPermission = HPM_map_add_group_permission; } bool HPM_map_add_atcommand(char *name, AtCommandFunc func) { diff --git a/src/map/map.c b/src/map/map.c index 9a6c8b70b..e05e77f46 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5662,10 +5662,6 @@ void map_hp_symbols(void) { #endif HPM->share(mapit,"mapit"); HPM->share(mapindex,"mapindex"); - /* specific */ - HPM->share(atcommand->create,"addCommand"); - HPM->share(script->addScript,"addScript"); - HPM->share(HPM_map_add_group_permission,"addGroupPermission"); } void map_load_defaults(void) { |