summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-26 18:37:23 +0000
committerepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-26 18:37:23 +0000
commit273c5d25155c1b28cf26274fe32be3ed305bf188 (patch)
tree5cc6ec7e788e6bbbf20f5f170305f1d71b86a20f /src/map/script.c
parent70c27fd7623e428c76abf9023f985e5d0630d55c (diff)
downloadhercules-273c5d25155c1b28cf26274fe32be3ed305bf188.tar.gz
hercules-273c5d25155c1b28cf26274fe32be3ed305bf188.tar.bz2
hercules-273c5d25155c1b28cf26274fe32be3ed305bf188.tar.xz
hercules-273c5d25155c1b28cf26274fe32be3ed305bf188.zip
- Added support for scripts to call user-defined functions without the use of callfunc
- Note: the callfunc; method is still required to be defined in the source git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15979 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 9fe8cd2e0..e56c06db8 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -951,8 +951,21 @@ const char* parse_callfunc(const char* p, int require_paren)
disp_error_message("parse_callfunc: callsub has no arguments, please review it's definition",p);
if( *arg != '*' )
++arg; // count func as argument
- } else
- disp_error_message("parse_line: expect command, missing function name or calling undeclared function",p);
+ } else {
+ const char* name = get_str(func);
+ if( strdb_get(userfunc_db, name) == NULL ) {
+ disp_error_message("parse_line: expect command, missing function name or calling undeclared function",p);
+ } else {
+ int callfunc = search_str("callfunc");
+ add_scriptl(callfunc);
+ add_scriptc(C_ARG);
+ add_scriptc(C_STR);
+ while( *name ) add_scriptb(*name ++);
+ add_scriptb(0);
+ arg = buildin_func[str_data[callfunc].val].arg;
+ if( *arg != '*' ) ++ arg;
+ }
+ }
p = skip_word(p);
p = skip_space(p);