diff options
author | gumi <git@gumi.ca> | 2018-07-30 14:43:53 -0400 |
---|---|---|
committer | gumi <git@gumi.ca> | 2018-07-30 14:47:16 -0400 |
commit | 4118b1135eb79c211aafb6408a4ad8cf9ce09b02 (patch) | |
tree | b24c10e28656f91336ffc08def4e41ddca818ef2 /src/map/script.c | |
parent | 87eb2f98518a63a3f640b97ad62c8b18a5d6b946 (diff) | |
download | hercules-4118b1135eb79c211aafb6408a4ad8cf9ce09b02.tar.gz hercules-4118b1135eb79c211aafb6408a4ad8cf9ce09b02.tar.bz2 hercules-4118b1135eb79c211aafb6408a4ad8cf9ce09b02.tar.xz hercules-4118b1135eb79c211aafb6408a4ad8cf9ce09b02.zip |
push constants as C_NAME in the script buffer
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/map/script.c b/src/map/script.c index f9b23cc45..67e3e5fc2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1378,6 +1378,11 @@ static const char *parse_simpleexpr_name(const char *p) disp_error_message("parse_simpleexpr: unmatched ']'", p); ++p; script->addc(C_FUNC); + } else if (script->str_data[l].type == C_INT) { + script->addc(C_NAME); + script->addb(l); + script->addb(l >> 8); + script->addb(l >> 16); } else { script->addl(l); } @@ -2898,8 +2903,7 @@ static struct script_data *get_val(struct script_state *st, struct script_data * return data; } - //##TODO use reference_tovariable(data) when it's confirmed that it works [FlavioJS] - if (!reference_toconstant(data) && not_server_variable(prefix) && reference_getref(data) == NULL) { + if (((reference_tovariable(data) && not_server_variable(prefix)) || reference_toparam(data)) && reference_getref(data) == NULL) { sd = script->rid2sd(st); if (sd == NULL) {// needs player attached if (postfix == '$') {// string variable @@ -3044,6 +3048,10 @@ static const void *get_val2(struct script_state *st, int64 uid, struct reg_db *r script->get_val(st, data); if (data->type == C_INT) // u.num is int32 because it comes from script->get_val return (const void *)h64BPTRSIZE((int32)data->u.num); + else if (data_isreference(data) && reference_toconstant(data)) + return (const void *)h64BPTRSIZE((int32)reference_getconstant(data)); + else if (data_isreference(data) && reference_toparam(data)) + return (const void *)h64BPTRSIZE((int32)reference_getparamtype(data)); else return (const void *)h64BPTRSIZE(data->u.str); } |