summaryrefslogtreecommitdiff
path: root/src/map/script.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-12-25 20:10:29 +0100
committerHaru <haru@dotalux.com>2013-12-30 16:08:20 +0100
commitfefaf392529f71debc63294ed6ee01938cb73eff (patch)
treeb260eacab35f4a66fd3e581ea28844bd2b4b1a14 /src/map/script.h
parente73bf15c254d31a5d12453c7aa52671b058d4361 (diff)
downloadhercules-fefaf392529f71debc63294ed6ee01938cb73eff.tar.gz
hercules-fefaf392529f71debc63294ed6ee01938cb73eff.tar.bz2
hercules-fefaf392529f71debc63294ed6ee01938cb73eff.tar.xz
hercules-fefaf392529f71debc63294ed6ee01938cb73eff.zip
Added support for string vars on commands that require a string
- Fixes bugreport:7901, thanks to Angelmelody http://hercules.ws/board/tracker/issue-7901-about-pass-variable-type-as-function-parameter - Bonus: debugmes can now take both strings and numbers (i.e. to print a number variable you no longer need to do 'debugmes "" + .@num;') Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/script.h')
-rw-r--r--src/map/script.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/map/script.h b/src/map/script.h
index 8076ea02e..2f7499569 100644
--- a/src/map/script.h
+++ b/src/map/script.h
@@ -85,6 +85,8 @@ struct eri;
#define script_isstring(st,i) data_isstring(script_getdata((st),(i)))
#define script_isint(st,i) data_isint(script_getdata((st),(i)))
+#define script_isstringtype(st,i) data_isstring(script->get_val((st), script_getdata((st),(i))))
+#define script_isinttype(st,i) data_isint(script->get_val((st), script_getdata((st),(i))))
#define script_getnum(st,val) (script->conv_num((st), script_getdata((st),(val))))
#define script_getstr(st,val) (script->conv_str((st), script_getdata((st),(val))))
@@ -548,7 +550,7 @@ struct script_interface {
TBL_PC *(*rid2sd) (struct script_state *st);
void (*detach_rid) (struct script_state* st);
struct script_data* (*push_val)(struct script_stack* stack, enum c_op type, int val, struct DBMap** ref);
- void (*get_val) (struct script_state* st, struct script_data* data);
+ struct script_data *(*get_val) (struct script_state* st, struct script_data* data);
void* (*get_val2) (struct script_state* st, int uid, struct DBMap** ref);
struct script_data* (*push_str) (struct script_stack* stack, enum c_op type, char* str);
struct script_data* (*push_copy) (struct script_stack* stack, int pos);