diff options
author | Haruna <haru@dotalux.com> | 2014-11-14 21:24:36 +0100 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2014-11-14 21:24:36 +0100 |
commit | 1ea115f7d795f8f5dea429172d7b4ab8f2b14d18 (patch) | |
tree | 2d2fb2fbcb10398eef1c1ad09b68bf579bccc25b | |
parent | 2e6d71cf134c1415a626cb1adddcc30428d467b5 (diff) | |
parent | 194c9106c0b2009ee81574565bea88fd67019659 (diff) | |
download | hercules-1ea115f7d795f8f5dea429172d7b4ab8f2b14d18.tar.gz hercules-1ea115f7d795f8f5dea429172d7b4ab8f2b14d18.tar.bz2 hercules-1ea115f7d795f8f5dea429172d7b4ab8f2b14d18.tar.xz hercules-1ea115f7d795f8f5dea429172d7b4ab8f2b14d18.zip |
Merge pull request #391 from 4144/addscriptdeprecated
Add plugins "function" addScriptCommandDeprecated
-rw-r--r-- | src/common/HPMi.h | 10 | ||||
-rw-r--r-- | src/map/script.c | 4 | ||||
-rw-r--r-- | src/map/script.h | 2 | ||||
-rw-r--r-- | src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 12 |
4 files changed, 17 insertions, 11 deletions
diff --git a/src/common/HPMi.h b/src/common/HPMi.h index 485586f6f..a7435b437 100644 --- a/src/common/HPMi.h +++ b/src/common/HPMi.h @@ -136,10 +136,16 @@ enum HPluginConfType { /* HPMi->addScript */ #define addScriptCommand(cname,scinfo,funcname) \ if ( HPMi->addScript != NULL ) { \ - HPMi->addScript(cname,scinfo,buildin_ ## funcname); \ + 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 ) { \ + 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 ) { \ @@ -162,7 +168,7 @@ HPExport struct HPMi_interface { /* */ void (*event[HPET_MAX]) (void); bool (*addCommand) (char *name, bool (*func)(const int fd, struct map_session_data* sd, const char* command, const char* message,struct AtCommandInfo *info)); - bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st)); + bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated); void (*addCPCommand) (char *name, CParseFunc func); /* HPM Custom Data */ void (*addToHPData) (enum HPluginDataTypes type, unsigned int pluginID, void *ptr, void *data, unsigned int index, bool autofree); diff --git a/src/map/script.c b/src/map/script.c index 9ff1b20a7..56bccbdec 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18985,12 +18985,12 @@ bool script_add_builtin(const struct script_function *buildin, bool override) { return true; } -bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)) { +bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated) { struct script_function buildin; buildin.name = name; buildin.arg = args; buildin.func = func; - buildin.deprecated = false; + buildin.deprecated = isDeprecated; return script->add_builtin(&buildin, true); } diff --git a/src/map/script.h b/src/map/script.h index 1a46ba02b..90804dd5b 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -576,7 +576,7 @@ struct script_interface { void (*error) (const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos); void (*warning) (const char* src, const char* file, int start_line, const char* error_msg, const char* error_pos); /* */ - bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st)); + bool (*addScript) (char *name, char *args, bool (*func)(struct script_state *st), bool isDeprecated); int (*conv_num) (struct script_state *st,struct script_data *data); const char* (*conv_str) (struct script_state *st,struct script_data *data); TBL_PC *(*rid2sd) (struct script_state *st); diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 102c486d9..57a609024 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -54219,15 +54219,15 @@ void HP_script_warning(const char *src, const char *file, int start_line, const } return; } -bool HP_script_addScript(char *name, char *args, bool ( *func ) (struct script_state *st)) { +bool HP_script_addScript(char *name, char *args, bool ( *func ) (struct script_state *st), bool isDeprecated) { int hIndex = 0; bool retVal___ = false; if( HPMHooks.count.HP_script_addScript_pre ) { - bool (*preHookFunc) (char *name, char *args, bool ( *func ) (struct script_state *st)); + bool (*preHookFunc) (char *name, char *args, bool ( *func ) (struct script_state *st), bool *isDeprecated); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_script_addScript_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_script_addScript_pre[hIndex].func; - retVal___ = preHookFunc(name, args, func); + retVal___ = preHookFunc(name, args, func, &isDeprecated); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -54235,13 +54235,13 @@ bool HP_script_addScript(char *name, char *args, bool ( *func ) (struct script_s } } { - retVal___ = HPMHooks.source.script.addScript(name, args, func); + retVal___ = HPMHooks.source.script.addScript(name, args, func, isDeprecated); } if( HPMHooks.count.HP_script_addScript_post ) { - bool (*postHookFunc) (bool retVal___, char *name, char *args, bool ( *func ) (struct script_state *st)); + bool (*postHookFunc) (bool retVal___, char *name, char *args, bool ( *func ) (struct script_state *st), bool *isDeprecated); for(hIndex = 0; hIndex < HPMHooks.count.HP_script_addScript_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_script_addScript_post[hIndex].func; - retVal___ = postHookFunc(retVal___, name, args, func); + retVal___ = postHookFunc(retVal___, name, args, func, &isDeprecated); } } return retVal___; |