From 3a8941f10d86563b9e881519846012e23299a45f Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 11 Aug 2015 01:57:27 +0200 Subject: Moved sql_handle into the HPMi interface Signed-off-by: Haru --- src/char/HPMchar.c | 1 + src/char/char.c | 1 - src/common/HPM.c | 8 -------- src/common/HPMi.h | 3 ++- src/login/HPMlogin.c | 1 + src/map/HPMmap.c | 1 + src/map/map.c | 2 -- 7 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/char/HPMchar.c b/src/char/HPMchar.c index b1ff72628..3e8470e9b 100644 --- a/src/char/HPMchar.c +++ b/src/char/HPMchar.c @@ -57,6 +57,7 @@ bool HPM_char_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTyp } void HPM_char_plugin_load_sub(struct hplugin *plugin) { + plugin->hpi->sql_handle = inter->sql_handle; } void HPM_char_do_init(void) { diff --git a/src/char/char.c b/src/char/char.c index 811507602..625103b71 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -5824,7 +5824,6 @@ void char_hp_symbols(void) { HPM->share(loginif, "loginif"); HPM->share(mapif, "mapif"); HPM->share(pincode, "pincode"); - HPM->share(inter->sql_handle, "sql_handle"); } /** diff --git a/src/common/HPM.c b/src/common/HPM.c index b4594d1ca..8963630b1 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -102,7 +102,6 @@ struct hplugin *hplugin_load(const char* filename) { struct HPMi_interface **HPMi; bool anyEvent = false; void **import_symbol_ref; - Sql **sql_handle; int *HPMDataCheckVer; unsigned int *HPMDataCheckLen; struct s_HPMDataCheck *HPMDataCheck; @@ -146,13 +145,6 @@ struct hplugin *hplugin_load(const char* filename) { *import_symbol_ref = HPM->import_symbol; - if( !( sql_handle = plugin_import(plugin->dll, "mysql_handle",Sql **) ) ) { - ShowFatalError("HPM:plugin_load: failed to retrieve 'mysql_handle' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); - exit(EXIT_FAILURE); - } - - *sql_handle = HPM->import_symbol("sql_handle",plugin->idx); - if( !( HPMi = plugin_import(plugin->dll, "HPMi",struct HPMi_interface **) ) ) { ShowFatalError("HPM:plugin_load: failed to retrieve 'HPMi' for '"CL_WHITE"%s"CL_RESET"'!\n", filename); exit(EXIT_FAILURE); diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 244a9e0ab..5f677cce3 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -211,12 +211,13 @@ struct HPMi_interface { bool (*addConf) (unsigned int pluginID, enum HPluginConfType type, char *name, void (*func) (const char *val)); /* pc group permission */ void (*addPCGPermission) (unsigned int pluginID, char *name, unsigned int *mask); + + Sql *sql_handle; }; #ifndef HERCULES_CORE HPExport struct HPMi_interface HPMi_s; HPExport struct HPMi_interface *HPMi; HPExport void *(*import_symbol) (char *name, unsigned int pID); -HPExport Sql *mysql_handle; #define HPM_SYMBOL(n, s) ((s) = import_symbol((n),HPMi->pid)) #endif // !HERCULES_CORE diff --git a/src/login/HPMlogin.c b/src/login/HPMlogin.c index 1530a1ccb..b1c097a52 100644 --- a/src/login/HPMlogin.c +++ b/src/login/HPMlogin.c @@ -42,6 +42,7 @@ bool HPM_login_grabHPData(struct HPDataOperationStorage *ret, enum HPluginDataTy } void HPM_login_plugin_load_sub(struct hplugin *plugin) { + plugin->hpi->sql_handle = account_db_sql_up(login->accounts); } void HPM_login_do_init(void) { diff --git a/src/map/HPMmap.c b/src/map/HPMmap.c index 7600d3d0c..9029a6a78 100644 --- a/src/map/HPMmap.c +++ b/src/map/HPMmap.c @@ -135,6 +135,7 @@ 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); diff --git a/src/map/map.c b/src/map/map.c index 115ad510d..9a6c8b70b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5662,8 +5662,6 @@ void map_hp_symbols(void) { #endif HPM->share(mapit,"mapit"); HPM->share(mapindex,"mapindex"); - /* sql link */ - HPM->share(map->mysql_handle,"sql_handle"); /* specific */ HPM->share(atcommand->create,"addCommand"); HPM->share(script->addScript,"addScript"); -- cgit v1.2.3-70-g09d2