summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-06-05 20:07:44 -0400
committergumi <mekolat@users.noreply.github.com>2017-06-05 20:08:42 -0400
commit16fec374f750c758683e3cd0145c4cb79fc1148f (patch)
treee4f443c2f9df0e4f3373a2186314bb489c583eea /src/map/script.c
parent2f2fe7faf7456edb7e39c2c887d1dc7d2ba3b577 (diff)
downloadhercules-16fec374f750c758683e3cd0145c4cb79fc1148f.tar.gz
hercules-16fec374f750c758683e3cd0145c4cb79fc1148f.tar.bz2
hercules-16fec374f750c758683e3cd0145c4cb79fc1148f.tar.xz
hercules-16fec374f750c758683e3cd0145c4cb79fc1148f.zip
fix loss of reference in buildin_swap
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/map/script.c b/src/map/script.c
index b22c88cfe..e20c79693 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -17032,6 +17032,7 @@ BUILDIN(swap)
{
struct map_session_data *sd = NULL;
struct script_data *data1, *data2;
+ struct reg_db *ref1, *ref2;
const char *varname1, *varname2;
int64 uid1, uid2;
@@ -17072,6 +17073,8 @@ BUILDIN(swap)
uid1 = reference_getuid(data1);
uid2 = reference_getuid(data2);
+ ref1 = reference_getref(data1);
+ ref2 = reference_getref(data2);
if (is_string_variable(varname1)) {
const char *value1, *value2;
@@ -17080,8 +17083,8 @@ BUILDIN(swap)
value2 = script_getstr(st,3);
if (strcmpi(value1, value2)) {
- script->set_reg(st, sd, uid1, varname1, value2, script_getref(st,3));
- script->set_reg(st, sd, uid2, varname2, value1, script_getref(st,2));
+ script->set_reg(st, sd, uid1, varname1, value2, ref1);
+ script->set_reg(st, sd, uid2, varname2, value1, ref2);
}
}
else {
@@ -17091,8 +17094,8 @@ BUILDIN(swap)
value2 = script_getnum(st,3);
if (value1 != value2) {
- script->set_reg(st, sd, uid1, varname1, (const void *)h64BPTRSIZE(value2), script_getref(st,3));
- script->set_reg(st, sd, uid2, varname2, (const void *)h64BPTRSIZE(value1), script_getref(st,2));
+ script->set_reg(st, sd, uid1, varname1, (const void *)h64BPTRSIZE(value2), ref1);
+ script->set_reg(st, sd, uid2, varname2, (const void *)h64BPTRSIZE(value1), ref2);
}
}
return true;