diff options
author | Haru <haru@dotalux.com> | 2019-09-23 00:43:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-23 00:43:14 +0200 |
commit | ab1127c269daa390f1648f6e8615fe8c209d879e (patch) | |
tree | 0533a577d20b4b59d04907729e3dc22468b4dd32 /src/plugins/HPMHooking | |
parent | 12b28c17795d795e8a091f083560d4fa9dea3b1e (diff) | |
parent | 548aa1263b69c2c5551d2c5f3d501ebc82d1e067 (diff) | |
download | hercules-ab1127c269daa390f1648f6e8615fe8c209d879e.tar.gz hercules-ab1127c269daa390f1648f6e8615fe8c209d879e.tar.bz2 hercules-ab1127c269daa390f1648f6e8615fe8c209d879e.tar.xz hercules-ab1127c269daa390f1648f6e8615fe8c209d879e.zip |
Merge pull request #2529 from Asheraf/itemcombolibconf
Convert item combo db to use libconfig
Diffstat (limited to 'src/plugins/HPMHooking')
4 files changed, 42 insertions, 41 deletions
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 5fb0c1555..433d9338e 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -4056,10 +4056,10 @@ typedef int (*HPMHOOK_pre_itemdb_isidentified) (int *nameid); typedef int (*HPMHOOK_post_itemdb_isidentified) (int retVal___, int nameid); typedef int (*HPMHOOK_pre_itemdb_isidentified2) (struct item_data **data); typedef int (*HPMHOOK_post_itemdb_isidentified2) (int retVal___, struct item_data *data); -typedef int (*HPMHOOK_pre_itemdb_combo_split_atoi) (char **str, int **val); -typedef int (*HPMHOOK_post_itemdb_combo_split_atoi) (int retVal___, char *str, int *val); -typedef void (*HPMHOOK_pre_itemdb_read_combos) (void); -typedef void (*HPMHOOK_post_itemdb_read_combos) (void); +typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig) (void); +typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig) (bool retVal___); +typedef bool (*HPMHOOK_pre_itemdb_read_combodb_libconfig_sub) (struct config_setting_t **it, int *idx, const char **source); +typedef bool (*HPMHOOK_post_itemdb_read_combodb_libconfig_sub) (bool retVal___, struct config_setting_t *it, int idx, const char *source); typedef int (*HPMHOOK_pre_itemdb_gendercheck) (struct item_data **id); typedef int (*HPMHOOK_post_itemdb_gendercheck) (int retVal___, struct item_data *id); typedef int (*HPMHOOK_pre_itemdb_validate_entry) (struct item_data **entry, int *n, const char **source); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index aa73d8748..37c42d8c2 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -3232,10 +3232,10 @@ struct { struct HPMHookPoint *HP_itemdb_isidentified_post; struct HPMHookPoint *HP_itemdb_isidentified2_pre; struct HPMHookPoint *HP_itemdb_isidentified2_post; - struct HPMHookPoint *HP_itemdb_combo_split_atoi_pre; - struct HPMHookPoint *HP_itemdb_combo_split_atoi_post; - struct HPMHookPoint *HP_itemdb_read_combos_pre; - struct HPMHookPoint *HP_itemdb_read_combos_post; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_pre; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_post; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_pre; + struct HPMHookPoint *HP_itemdb_read_combodb_libconfig_sub_post; struct HPMHookPoint *HP_itemdb_gendercheck_pre; struct HPMHookPoint *HP_itemdb_gendercheck_post; struct HPMHookPoint *HP_itemdb_validate_entry_pre; @@ -10029,10 +10029,10 @@ struct { int HP_itemdb_isidentified_post; int HP_itemdb_isidentified2_pre; int HP_itemdb_isidentified2_post; - int HP_itemdb_combo_split_atoi_pre; - int HP_itemdb_combo_split_atoi_post; - int HP_itemdb_read_combos_pre; - int HP_itemdb_read_combos_post; + int HP_itemdb_read_combodb_libconfig_pre; + int HP_itemdb_read_combodb_libconfig_post; + int HP_itemdb_read_combodb_libconfig_sub_pre; + int HP_itemdb_read_combodb_libconfig_sub_post; int HP_itemdb_gendercheck_pre; int HP_itemdb_gendercheck_post; int HP_itemdb_validate_entry_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index ddc3e643c..748db6123 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1655,8 +1655,8 @@ struct HookingPointData HookingPoints[] = { { HP_POP(itemdb->isrestricted, HP_itemdb_isrestricted) }, { HP_POP(itemdb->isidentified, HP_itemdb_isidentified) }, { HP_POP(itemdb->isidentified2, HP_itemdb_isidentified2) }, - { HP_POP(itemdb->combo_split_atoi, HP_itemdb_combo_split_atoi) }, - { HP_POP(itemdb->read_combos, HP_itemdb_read_combos) }, + { HP_POP(itemdb->read_combodb_libconfig, HP_itemdb_read_combodb_libconfig) }, + { HP_POP(itemdb->read_combodb_libconfig_sub, HP_itemdb_read_combodb_libconfig_sub) }, { HP_POP(itemdb->gendercheck, HP_itemdb_gendercheck) }, { HP_POP(itemdb->validate_entry, HP_itemdb_validate_entry) }, { HP_POP(itemdb->readdb_options_additional_fields, HP_itemdb_readdb_options_additional_fields) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index f62cb4733..c9bdefbd7 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -42494,15 +42494,15 @@ int HP_itemdb_isidentified2(struct item_data *data) { } return retVal___; } -int HP_itemdb_combo_split_atoi(char *str, int *val) { +bool HP_itemdb_read_combodb_libconfig(void) { int hIndex = 0; - int retVal___ = 0; - if (HPMHooks.count.HP_itemdb_combo_split_atoi_pre > 0) { - int (*preHookFunc) (char **str, int **val); + bool retVal___ = false; + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre > 0) { + bool (*preHookFunc) (void); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_pre[hIndex].func; - retVal___ = preHookFunc(&str, &val); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_pre[hIndex].func; + retVal___ = preHookFunc(); } if (*HPMforce_return) { *HPMforce_return = false; @@ -42510,42 +42510,43 @@ int HP_itemdb_combo_split_atoi(char *str, int *val) { } } { - retVal___ = HPMHooks.source.itemdb.combo_split_atoi(str, val); + retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig(); } - if (HPMHooks.count.HP_itemdb_combo_split_atoi_post > 0) { - int (*postHookFunc) (int retVal___, char *str, int *val); - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_combo_split_atoi_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_itemdb_combo_split_atoi_post[hIndex].func; - retVal___ = postHookFunc(retVal___, str, val); + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_post > 0) { + bool (*postHookFunc) (bool retVal___); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_post[hIndex].func; + retVal___ = postHookFunc(retVal___); } } return retVal___; } -void HP_itemdb_read_combos(void) { +bool HP_itemdb_read_combodb_libconfig_sub(struct config_setting_t *it, int idx, const char *source) { int hIndex = 0; - if (HPMHooks.count.HP_itemdb_read_combos_pre > 0) { - void (*preHookFunc) (void); + bool retVal___ = false; + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre > 0) { + bool (*preHookFunc) (struct config_setting_t **it, int *idx, const char **source); *HPMforce_return = false; - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_pre; hIndex++) { - preHookFunc = HPMHooks.list.HP_itemdb_read_combos_pre[hIndex].func; - preHookFunc(); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_pre; hIndex++) { + preHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_pre[hIndex].func; + retVal___ = preHookFunc(&it, &idx, &source); } if (*HPMforce_return) { *HPMforce_return = false; - return; + return retVal___; } } { - HPMHooks.source.itemdb.read_combos(); + retVal___ = HPMHooks.source.itemdb.read_combodb_libconfig_sub(it, idx, source); } - if (HPMHooks.count.HP_itemdb_read_combos_post > 0) { - void (*postHookFunc) (void); - for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combos_post; hIndex++) { - postHookFunc = HPMHooks.list.HP_itemdb_read_combos_post[hIndex].func; - postHookFunc(); + if (HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post > 0) { + bool (*postHookFunc) (bool retVal___, struct config_setting_t *it, int idx, const char *source); + for (hIndex = 0; hIndex < HPMHooks.count.HP_itemdb_read_combodb_libconfig_sub_post; hIndex++) { + postHookFunc = HPMHooks.list.HP_itemdb_read_combodb_libconfig_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, it, idx, source); } } - return; + return retVal___; } int HP_itemdb_gendercheck(struct item_data *id) { int hIndex = 0; |