summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-14 13:33:33 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-14 13:33:33 +0300
commit8cbdcf9c92c8e9af767afd666733227dd68dddd3 (patch)
tree93ba6556f2449e2219d80ba284d5f66c0e06dac0
parentfe6599de91dbab781e37fbded66cfecb685041cf (diff)
downloadhercules-8cbdcf9c92c8e9af767afd666733227dd68dddd3.tar.gz
hercules-8cbdcf9c92c8e9af767afd666733227dd68dddd3.tar.bz2
hercules-8cbdcf9c92c8e9af767afd666733227dd68dddd3.tar.xz
hercules-8cbdcf9c92c8e9af767afd666733227dd68dddd3.zip
Add ability to add deprecated command from scripts and plugins.
-rw-r--r--src/common/HPMi.h10
-rw-r--r--src/map/script.c4
-rw-r--r--src/map/script.h2
3 files changed, 11 insertions, 5 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);