summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-30 12:50:56 +0000
committerepoque11 <epoque11@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-04-30 12:50:56 +0000
commit3259f89ff89ccae892938cd9d01e6e23300f52d0 (patch)
tree8cf7338219f4d7f5dd787cc866a61ce4def58e3b /src/map/script.c
parentde43fa0f73be01080bd11c08adbfb7c158324c81 (diff)
downloadhercules-3259f89ff89ccae892938cd9d01e6e23300f52d0.tar.gz
hercules-3259f89ff89ccae892938cd9d01e6e23300f52d0.tar.bz2
hercules-3259f89ff89ccae892938cd9d01e6e23300f52d0.tar.xz
hercules-3259f89ff89ccae892938cd9d01e6e23300f52d0.zip
- 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
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c14
1 files changed, 10 insertions, 4 deletions
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;
+ }
}
}