diff options
author | Smokexyz <sagunxp@gmail.com> | 2015-08-29 15:04:04 +0530 |
---|---|---|
committer | Smokexyz <sagunxp@gmail.com> | 2015-10-02 00:42:13 +0530 |
commit | 993138361b5d712afbd7afee6aba5d5c52bdcc4f (patch) | |
tree | d5572d3a5291044e7f890c8f7b9b160c5a1d733f /src/plugins | |
parent | f7a97b556e05373711998d4f819cf7d89e4b0ce8 (diff) | |
download | hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.gz hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.bz2 hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.tar.xz hercules-993138361b5d712afbd7afee6aba5d5c52bdcc4f.zip |
Convert refine_db.txt to refine_db.conf (libconfig)
Thanks for Haru and 4414 for pointing out inefficiency in code, edited
as suggested.
Rework - Changed refine_db.conf format to a more concise one, thanks to Haru for suggesting.
[2/10/15]
Updated with corrections pointed out by Haru.
Updated warning and error messages.
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc | 12 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc | 3 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 53 |
3 files changed, 50 insertions, 18 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index eab1d007e..bf1aee21b 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5427,8 +5427,10 @@ struct { struct HPMHookPoint *HP_status_readdb_job2_post; struct HPMHookPoint *HP_status_readdb_sizefix_pre; struct HPMHookPoint *HP_status_readdb_sizefix_post; - struct HPMHookPoint *HP_status_readdb_refine_pre; - struct HPMHookPoint *HP_status_readdb_refine_post; + struct HPMHookPoint *HP_status_readdb_refine_libconfig_pre; + struct HPMHookPoint *HP_status_readdb_refine_libconfig_post; + struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_pre; + struct HPMHookPoint *HP_status_readdb_refine_libconfig_sub_post; struct HPMHookPoint *HP_status_readdb_scconfig_pre; struct HPMHookPoint *HP_status_readdb_scconfig_post; struct HPMHookPoint *HP_status_read_job_db_pre; @@ -11140,8 +11142,10 @@ struct { int HP_status_readdb_job2_post; int HP_status_readdb_sizefix_pre; int HP_status_readdb_sizefix_post; - int HP_status_readdb_refine_pre; - int HP_status_readdb_refine_post; + int HP_status_readdb_refine_libconfig_pre; + int HP_status_readdb_refine_libconfig_post; + int HP_status_readdb_refine_libconfig_sub_pre; + int HP_status_readdb_refine_libconfig_sub_post; int HP_status_readdb_scconfig_pre; int HP_status_readdb_scconfig_post; int HP_status_read_job_db_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 4656f01c2..d9d8dc230 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2763,7 +2763,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(status->natural_heal_timer, HP_status_natural_heal_timer) }, { HP_POP(status->readdb_job2, HP_status_readdb_job2) }, { HP_POP(status->readdb_sizefix, HP_status_readdb_sizefix) }, - { HP_POP(status->readdb_refine, HP_status_readdb_refine) }, + { HP_POP(status->readdb_refine_libconfig, HP_status_readdb_refine_libconfig) }, + { HP_POP(status->readdb_refine_libconfig_sub, HP_status_readdb_refine_libconfig_sub) }, { HP_POP(status->readdb_scconfig, HP_status_readdb_scconfig) }, { HP_POP(status->read_job_db, HP_status_read_job_db) }, { HP_POP(status->read_job_db_sub, HP_status_read_job_db_sub) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index e6aad6dad..2454846f8 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -72994,15 +72994,15 @@ bool HP_status_readdb_sizefix(char *fields[], int columns, int current) { } return retVal___; } -bool HP_status_readdb_refine(char *fields[], int columns, int current) { +int HP_status_readdb_refine_libconfig_sub(config_setting_t *r, const char *name, const char *source) { int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_status_readdb_refine_pre ) { - bool (*preHookFunc) (char *fields[], int *columns, int *current); + int retVal___ = 0; + if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre ) { + int (*preHookFunc) (config_setting_t *r, const char *name, const char *source); *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_status_readdb_refine_pre[hIndex].func; - retVal___ = preHookFunc(fields, &columns, ¤t); + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(r, name, source); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -73010,13 +73010,40 @@ bool HP_status_readdb_refine(char *fields[], int columns, int current) { } } { - retVal___ = HPMHooks.source.status.readdb_refine(fields, columns, current); + retVal___ = HPMHooks.source.status.readdb_refine_libconfig_sub(r, name, source); } - if( HPMHooks.count.HP_status_readdb_refine_post ) { - bool (*postHookFunc) (bool retVal___, char *fields[], int *columns, int *current); - for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_status_readdb_refine_post[hIndex].func; - retVal___ = postHookFunc(retVal___, fields, &columns, ¤t); + if( HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post ) { + int (*postHookFunc) (int retVal___, config_setting_t *r, const char *name, const char *source); + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, r, name, source); + } + } + return retVal___; +} +int HP_status_readdb_refine_libconfig(const char *filename) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_status_readdb_refine_libconfig_pre ) { + int (*preHookFunc) (const char *filename); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(filename); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.status.readdb_refine_libconfig(filename); + } + if( HPMHooks.count.HP_status_readdb_refine_libconfig_post ) { + int (*postHookFunc) (int retVal___, const char *filename); + for(hIndex = 0; hIndex < HPMHooks.count.HP_status_readdb_refine_libconfig_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_status_readdb_refine_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___, filename); } } return retVal___; |