From 51d5198e6d5738a753be737940fec93370f02ec6 Mon Sep 17 00:00:00 2001 From: gumi Date: Wed, 3 Jan 2018 17:38:33 -0500 Subject: allow to fetch a npc var without an attached oid --- src/map/script-call.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp index 7c7d4e6..5714b41 100644 --- a/src/map/script-call.cpp +++ b/src/map/script-call.cpp @@ -96,18 +96,13 @@ void get_val(dumb_ptr sd, struct script_data *data) char prefix = name.front(); char postfix = name.back(); - if (prefix != '$') - { - if (sd == nullptr) - PRINTF("get_val error name?:%s\n"_fmt, name); - } if (postfix == '$') { RString str; - if (prefix == '@' || prefix == '.') + if (prefix == '@' || (prefix == '.' && name[1] != '@')) { if (sd) - str = pc_readregstr(sd, u.reg); + str = pc_readregstr(sd, u.reg); // sd can also be a nd: they're handled the same way } else if (prefix == '$') { @@ -128,10 +123,10 @@ void get_val(dumb_ptr sd, struct script_data *data) else { int numi = 0; - if (prefix == '@' || prefix == '.') + if (prefix == '@' || (prefix == '.' && name[1] != '@')) { if (sd) - numi = pc_readreg(sd, u.reg); + numi = pc_readreg(sd, u.reg); // sd can also be a nd: they're handled the same way } else if (prefix == '$') { -- cgit v1.2.3-60-g2f50