summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <mekolat@users.noreply.github.com>2017-07-10 18:23:50 -0400
committergumi <mekolat@users.noreply.github.com>2017-07-10 18:27:39 -0400
commit2c86a89a0a3e8a80140df9323de2618f10042859 (patch)
tree4a0f54f9882278394fddd930ae84cbef7e63e07d
parentdc98b569d9ea5eb396720bf68da617d81560229f (diff)
downloadhercules-2c86a89a0a3e8a80140df9323de2618f10042859.tar.gz
hercules-2c86a89a0a3e8a80140df9323de2618f10042859.tar.bz2
hercules-2c86a89a0a3e8a80140df9323de2618f10042859.tar.xz
hercules-2c86a89a0a3e8a80140df9323de2618f10042859.zip
fix setting pc var on another pc
-rw-r--r--src/map/script.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8184639e6..69c210b28 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -7038,6 +7038,7 @@ BUILDIN(__setr)
int64 num;
const char* name;
char prefix;
+ struct reg_db *ref;
data = script_getdata(st,2);
//datavalue = script_getdata(st,3);
@@ -7050,11 +7051,11 @@ BUILDIN(__setr)
num = reference_getuid(data);
name = reference_getname(data);
+ ref = reference_getref(data);
prefix = *name;
if (not_server_variable(prefix)) {
- sd = script->rid2sd(st);
- if (sd == NULL) {
+ if (ref == NULL && (sd = script->rid2sd(st)) == NULL) {
ShowError("script:set: no player attached for player variable '%s'\n", name);
return true;
}
@@ -7102,9 +7103,9 @@ BUILDIN(__setr)
}
if (is_string_variable(name))
- script->set_reg(st, sd, num, name, script_getstr(st, 3), script_getref(st, 2));
+ script->set_reg(st, sd, num, name, script_getstr(st, 3), ref);
else
- script->set_reg(st, sd, num, name, (const void *)h64BPTRSIZE(script_getnum(st, 3)), script_getref(st, 2));
+ script->set_reg(st, sd, num, name, (const void *)h64BPTRSIZE(script_getnum(st, 3)), ref);
return true;
}