summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgumi <git@gumi.ca>2018-01-03 17:38:33 -0500
committergumi <git@gumi.ca>2018-01-03 17:38:33 -0500
commit51d5198e6d5738a753be737940fec93370f02ec6 (patch)
treec82f739b5a503a43a8776bc544a6129357f5d977
parentb7ec6e535d314a64aeaf426e2e4c068cd7c4bb34 (diff)
downloadtmwa-51d5198e6d5738a753be737940fec93370f02ec6.tar.gz
tmwa-51d5198e6d5738a753be737940fec93370f02ec6.tar.bz2
tmwa-51d5198e6d5738a753be737940fec93370f02ec6.tar.xz
tmwa-51d5198e6d5738a753be737940fec93370f02ec6.zip
allow to fetch a npc var without an attached oid
-rw-r--r--src/map/script-call.cpp13
1 files changed, 4 insertions, 9 deletions
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<block_list> 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<block_list> 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 == '$')
{