summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-06-24 21:01:38 +0200
committerGitHub <noreply@github.com>2017-06-24 21:01:38 +0200
commitae82ea6b23d3bd068eb54fb7199fe0b35cf4ef64 (patch)
tree55e412a30ec8323699d5ac3746f3c61f140e6b46 /src/map/script.c
parentf6662b84641d51f25e7c2af21630d8d34b6ce06b (diff)
parent16fec374f750c758683e3cd0145c4cb79fc1148f (diff)
downloadhercules-ae82ea6b23d3bd068eb54fb7199fe0b35cf4ef64.tar.gz
hercules-ae82ea6b23d3bd068eb54fb7199fe0b35cf4ef64.tar.bz2
hercules-ae82ea6b23d3bd068eb54fb7199fe0b35cf4ef64.tar.xz
hercules-ae82ea6b23d3bd068eb54fb7199fe0b35cf4ef64.zip
Merge pull request #1765 from mekolat/swap2
fix for #1761
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 4640d1950..ee4bbf5ac 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16998,6 +16998,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;
@@ -17038,6 +17039,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;
@@ -17046,8 +17049,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 {
@@ -17057,8 +17060,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;