From 3259f89ff89ccae892938cd9d01e6e23300f52d0 Mon Sep 17 00:00:00 2001 From: epoque11 Date: Mon, 30 Apr 2012 12:50:56 +0000 Subject: - Fixed NPC instance variables not being passed through to callfunc; or callsub; stacks properly (bugreport:5673) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16018 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/script.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/map') diff --git a/src/map/script.c b/src/map/script.c index 6665a72b8..70c43b6a1 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2934,6 +2934,8 @@ void pop_stack(struct script_state* st, int start, int end) struct script_retinfo* ri = data->u.ri; if( ri->var_function ) script_free_vars(ri->var_function); + if( data->ref ) + aFree(data->ref); aFree(ri); } data->type = C_NOP; @@ -4467,8 +4469,10 @@ BUILDIN_FUNC(callfunc) if( data_isreference(data) && !data->ref ) { const char* name = reference_getname(data); - if( name[0] == '.' && name[1] == '@' ) - data->ref = &st->stack->var_function; + if( name[0] == '.' && name[1] == '@' ) { + data->ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1); + data->ref[0] = st->stack->var_function; + } else if( name[0] == '.' ) data->ref = &st->script->script_vars; } @@ -4513,8 +4517,10 @@ BUILDIN_FUNC(callsub) if( data_isreference(data) && !data->ref ) { const char* name = reference_getname(data); - if( name[0] == '.' && name[1] == '@' ) - data->ref = &st->stack->var_function; + if( name[0] == '.' && name[1] == '@' ) { + data->ref = (struct DBMap**)aCalloc(sizeof(struct DBMap*), 1); + data->ref[0] = st->stack->var_function; + } } } -- cgit v1.2.3-70-g09d2