diff options
author | Haru <haru@dotalux.com> | 2016-09-10 01:04:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-10 01:04:18 +0200 |
commit | 3d4e646d56afbde1e5ca58b7b791df876360092c (patch) | |
tree | da45b4fbeed6a992f135f8e19cc5d1d8638458ed | |
parent | a45a8d92d11acf1f3f2d10853bf60ebb515b84a5 (diff) | |
parent | ce55087fe7389c785515617c0b4c8628adeace53 (diff) | |
download | hercules-3d4e646d56afbde1e5ca58b7b791df876360092c.tar.gz hercules-3d4e646d56afbde1e5ca58b7b791df876360092c.tar.bz2 hercules-3d4e646d56afbde1e5ca58b7b791df876360092c.tar.xz hercules-3d4e646d56afbde1e5ca58b7b791df876360092c.zip |
Merge pull request #1416 from 4144/hpmfix
Add some fixes for HPM
-rwxr-xr-x | configure | 83 | ||||
-rw-r--r-- | src/map/skill.c | 15 | ||||
-rw-r--r-- | src/map/skill.h | 3 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking.Defs.inc | 6 | ||||
-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 | 81 |
7 files changed, 169 insertions, 34 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac 302aefb. +# From configure.ac 2d4789d. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -6066,33 +6066,6 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-omit-frame-pointer" >&5 -$as_echo_n "checking whether $CC supports -fno-omit-frame-pointer... " >&6; } - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fno-omit-frame-pointer" - OLD_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fno-omit-frame-pointer" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CFLAGS="$OLD_CFLAGS" - LDFLAGS="$OLD_LDFLAGS" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - fi fi @@ -8242,10 +8215,64 @@ case $enable_debug in "yes") CFLAGS="$CFLAGS -g" CPPFLAGS="$CPPFLAGS -DDEBUG" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-omit-frame-pointer" >&5 +$as_echo_n "checking whether $CC supports -fno-omit-frame-pointer... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-omit-frame-pointer" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fno-omit-frame-pointer" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + ;; "gdb") CFLAGS="$CFLAGS -ggdb" CPPFLAGS="$CPPFLAGS -DDEBUG" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -fno-omit-frame-pointer" >&5 +$as_echo_n "checking whether $CC supports -fno-omit-frame-pointer... " >&6; } + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-omit-frame-pointer" + OLD_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -fno-omit-frame-pointer" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + CFLAGS="$OLD_CFLAGS" + LDFLAGS="$OLD_LDFLAGS" + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + ;; esac diff --git a/src/map/skill.c b/src/map/skill.c index 40001659c..561154bdf 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -19417,7 +19417,7 @@ void skill_validate_castnodex(struct config_setting_t *conf, struct s_skill_db * * @param *sk struct, pointer to s_skill_db * @return void */ -int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk ) +int skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk) { if (strcmpi(type, "NoWeapon") == 0) { if (on) { @@ -19628,11 +19628,11 @@ void skill_validate_weapontype(struct config_setting_t *conf, struct s_skill_db int j = 0; struct config_setting_t *wpt = NULL; while ((wpt = libconfig->setting_get_elem(tt, j++)) != NULL) { - if (skill_validate_weapontype_sub(config_setting_name(wpt), libconfig->setting_get_bool_real(wpt), sk)) + if (skill->validate_weapontype_sub(config_setting_name(wpt), libconfig->setting_get_bool_real(wpt), sk)) skilldb_invalid_error(config_setting_name(wpt), config_setting_name(tt), sk->nameid); } } else if (libconfig->setting_lookup_string(conf, "WeaponTypes", &type)) { - if (skill_validate_weapontype_sub(type, true, sk)) + if (skill->validate_weapontype_sub(type, true, sk)) skilldb_invalid_error(type, "WeaponTypes", sk->nameid); } } @@ -19730,11 +19730,11 @@ void skill_validate_ammotype(struct config_setting_t *conf, struct s_skill_db *s int j = 0; struct config_setting_t *amt = { 0 }; while ((amt = libconfig->setting_get_elem(tt, j++))) { - if (skill_validate_ammotype_sub(config_setting_name(amt), libconfig->setting_get_bool_real(amt), sk)) + if (skill->validate_ammotype_sub(config_setting_name(amt), libconfig->setting_get_bool_real(amt), sk)) skilldb_invalid_error(config_setting_name(amt), config_setting_name(tt), sk->nameid); } } else if( libconfig->setting_lookup_string(conf, "AmmoTypes", &tstr)) { - if (skill_validate_ammotype_sub(tstr, true, sk)) + if (skill->validate_ammotype_sub(tstr, true, sk)) skilldb_invalid_error(tstr, "AmmoTypes", sk->nameid); } } @@ -19967,7 +19967,7 @@ void skill_validate_unit_flag(struct config_setting_t *conf, struct s_skill_db * while ((tt = libconfig->setting_get_elem(t, j++))) { const char *name = config_setting_name(tt); - if (skill_validate_unit_flag_sub(name, libconfig->setting_get_bool_real(tt), sk)) + if (skill->validate_unit_flag_sub(name, libconfig->setting_get_bool_real(tt), sk)) skilldb_invalid_error(name, config_setting_name(t), sk->nameid); } } @@ -20605,6 +20605,9 @@ void skill_defaults(void) { skill->validate_unit_flag = skill_validate_unit_flag; skill->validate_additional_fields = skill_validate_additional_fields; skill->validate_skilldb = skill_validate_skilldb; + skill->validate_weapontype_sub = skill_validate_weapontype_sub; + skill->validate_ammotype_sub = skill_validate_ammotype_sub; + skill->validate_unit_flag_sub = skill_validate_unit_flag_sub; skill->read_skilldb = skill_read_skilldb; skill->config_set_level = skill_config_set_level; skill->level_set_value = skill_level_set_value; diff --git a/src/map/skill.h b/src/map/skill.h index c37f9ec41..c7761b082 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -2056,6 +2056,9 @@ struct skill_interface { void (*validate_unit_flag) (struct config_setting_t *conf, struct s_skill_db *sk); void (*validate_additional_fields) (struct config_setting_t *conf, struct s_skill_db *sk); bool (*validate_skilldb) (struct s_skill_db *skt, const char *source); + int (*validate_weapontype_sub) (const char *type, bool on, struct s_skill_db *sk); + int (*validate_ammotype_sub) (const char *type, bool on, struct s_skill_db *sk); + int (*validate_unit_flag_sub) (const char *type, bool on, struct s_skill_db *sk); bool (*read_skilldb) (const char *filename); void (*config_set_level) (struct config_setting_t *conf, int *arr); void (*level_set_value) (int *arr, int value); diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc index 9968d1d18..c020d3130 100644 --- a/src/plugins/HPMHooking/HPMHooking.Defs.inc +++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc @@ -6508,6 +6508,12 @@ typedef void (*HPMHOOK_pre_skill_validate_additional_fields) (struct config_sett typedef void (*HPMHOOK_post_skill_validate_additional_fields) (struct config_setting_t *conf, struct s_skill_db *sk); typedef bool (*HPMHOOK_pre_skill_validate_skilldb) (struct s_skill_db **skt, const char **source); typedef bool (*HPMHOOK_post_skill_validate_skilldb) (bool retVal___, struct s_skill_db *skt, const char *source); +typedef int (*HPMHOOK_pre_skill_validate_weapontype_sub) (const char **type, bool *on, struct s_skill_db **sk); +typedef int (*HPMHOOK_post_skill_validate_weapontype_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk); +typedef int (*HPMHOOK_pre_skill_validate_ammotype_sub) (const char **type, bool *on, struct s_skill_db **sk); +typedef int (*HPMHOOK_post_skill_validate_ammotype_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk); +typedef int (*HPMHOOK_pre_skill_validate_unit_flag_sub) (const char **type, bool *on, struct s_skill_db **sk); +typedef int (*HPMHOOK_post_skill_validate_unit_flag_sub) (int retVal___, const char *type, bool on, struct s_skill_db *sk); typedef bool (*HPMHOOK_pre_skill_read_skilldb) (const char **filename); typedef bool (*HPMHOOK_post_skill_read_skilldb) (bool retVal___, const char *filename); typedef void (*HPMHOOK_pre_skill_config_set_level) (struct config_setting_t **conf, int **arr); diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index 0845d8cdd..c0b0fa9f6 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -5296,6 +5296,12 @@ struct { struct HPMHookPoint *HP_skill_validate_additional_fields_post; struct HPMHookPoint *HP_skill_validate_skilldb_pre; struct HPMHookPoint *HP_skill_validate_skilldb_post; + struct HPMHookPoint *HP_skill_validate_weapontype_sub_pre; + struct HPMHookPoint *HP_skill_validate_weapontype_sub_post; + struct HPMHookPoint *HP_skill_validate_ammotype_sub_pre; + struct HPMHookPoint *HP_skill_validate_ammotype_sub_post; + struct HPMHookPoint *HP_skill_validate_unit_flag_sub_pre; + struct HPMHookPoint *HP_skill_validate_unit_flag_sub_post; struct HPMHookPoint *HP_skill_read_skilldb_pre; struct HPMHookPoint *HP_skill_read_skilldb_post; struct HPMHookPoint *HP_skill_config_set_level_pre; @@ -11351,6 +11357,12 @@ struct { int HP_skill_validate_additional_fields_post; int HP_skill_validate_skilldb_pre; int HP_skill_validate_skilldb_post; + int HP_skill_validate_weapontype_sub_pre; + int HP_skill_validate_weapontype_sub_post; + int HP_skill_validate_ammotype_sub_pre; + int HP_skill_validate_ammotype_sub_post; + int HP_skill_validate_unit_flag_sub_pre; + int HP_skill_validate_unit_flag_sub_post; int HP_skill_read_skilldb_pre; int HP_skill_read_skilldb_post; int HP_skill_config_set_level_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 30ede196a..9f05884a4 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -2712,6 +2712,9 @@ struct HookingPointData HookingPoints[] = { { HP_POP(skill->validate_unit_flag, HP_skill_validate_unit_flag) }, { HP_POP(skill->validate_additional_fields, HP_skill_validate_additional_fields) }, { HP_POP(skill->validate_skilldb, HP_skill_validate_skilldb) }, + { HP_POP(skill->validate_weapontype_sub, HP_skill_validate_weapontype_sub) }, + { HP_POP(skill->validate_ammotype_sub, HP_skill_validate_ammotype_sub) }, + { HP_POP(skill->validate_unit_flag_sub, HP_skill_validate_unit_flag_sub) }, { HP_POP(skill->read_skilldb, HP_skill_read_skilldb) }, { HP_POP(skill->config_set_level, HP_skill_config_set_level) }, { HP_POP(skill->level_set_value, HP_skill_level_set_value) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 819c3b28c..b1bc0ce34 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -70906,6 +70906,87 @@ bool HP_skill_validate_skilldb(struct s_skill_db *skt, const char *source) { } return retVal___; } +int HP_skill_validate_weapontype_sub(const char *type, bool on, struct s_skill_db *sk) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_skill_validate_weapontype_sub_pre ) { + int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_weapontype_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_skill_validate_weapontype_sub_pre[hIndex].func; + retVal___ = preHookFunc(&type, &on, &sk); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.validate_weapontype_sub(type, on, sk); + } + if( HPMHooks.count.HP_skill_validate_weapontype_sub_post ) { + int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk); + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_weapontype_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_skill_validate_weapontype_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, type, on, sk); + } + } + return retVal___; +} +int HP_skill_validate_ammotype_sub(const char *type, bool on, struct s_skill_db *sk) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_skill_validate_ammotype_sub_pre ) { + int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_ammotype_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_skill_validate_ammotype_sub_pre[hIndex].func; + retVal___ = preHookFunc(&type, &on, &sk); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.validate_ammotype_sub(type, on, sk); + } + if( HPMHooks.count.HP_skill_validate_ammotype_sub_post ) { + int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk); + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_ammotype_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_skill_validate_ammotype_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, type, on, sk); + } + } + return retVal___; +} +int HP_skill_validate_unit_flag_sub(const char *type, bool on, struct s_skill_db *sk) { + int hIndex = 0; + int retVal___ = 0; + if( HPMHooks.count.HP_skill_validate_unit_flag_sub_pre ) { + int (*preHookFunc) (const char **type, bool *on, struct s_skill_db **sk); + *HPMforce_return = false; + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_unit_flag_sub_pre; hIndex++ ) { + preHookFunc = HPMHooks.list.HP_skill_validate_unit_flag_sub_pre[hIndex].func; + retVal___ = preHookFunc(&type, &on, &sk); + } + if( *HPMforce_return ) { + *HPMforce_return = false; + return retVal___; + } + } + { + retVal___ = HPMHooks.source.skill.validate_unit_flag_sub(type, on, sk); + } + if( HPMHooks.count.HP_skill_validate_unit_flag_sub_post ) { + int (*postHookFunc) (int retVal___, const char *type, bool on, struct s_skill_db *sk); + for(hIndex = 0; hIndex < HPMHooks.count.HP_skill_validate_unit_flag_sub_post; hIndex++ ) { + postHookFunc = HPMHooks.list.HP_skill_validate_unit_flag_sub_post[hIndex].func; + retVal___ = postHookFunc(retVal___, type, on, sk); + } + } + return retVal___; +} bool HP_skill_read_skilldb(const char *filename) { int hIndex = 0; bool retVal___ = false; |