summaryrefslogtreecommitdiff
path: root/src/map/script-call.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-09-01 15:01:01 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:46:35 -0400
commitf3dd34b5172f2bcb4f79d472e4c8ba2dbfe9cce0 (patch)
tree68e4507bc2aa8e66d4770876a45276b617028f6b /src/map/script-call.cpp
parentcf6f557700db4f88050674468a70a38f93441e98 (diff)
downloadtmwa-f3dd34b5172f2bcb4f79d472e4c8ba2dbfe9cce0.tar.gz
tmwa-f3dd34b5172f2bcb4f79d472e4c8ba2dbfe9cce0.tar.bz2
tmwa-f3dd34b5172f2bcb4f79d472e4c8ba2dbfe9cce0.tar.xz
tmwa-f3dd34b5172f2bcb4f79d472e4c8ba2dbfe9cce0.zip
convert unhandled types for scope vars
Diffstat (limited to 'src/map/script-call.cpp')
-rw-r--r--src/map/script-call.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp
index b397fb4..0164c2a 100644
--- a/src/map/script-call.cpp
+++ b/src/map/script-call.cpp
@@ -270,12 +270,12 @@ void set_reg(dumb_ptr<block_list> sd, VariableCode type, SIR reg, struct script_
}
}
-void set_scope_reg(ScriptState *st, SIR reg, struct script_data vd)
+void set_scope_reg(ScriptState *st, SIR reg, struct script_data *vd)
{
ZString name = variable_names.outtern(reg.base());
if (name.back() == '$')
{
- if (auto *u = vd.get_if<ScriptDataStr>())
+ if (auto *u = vd->get_if<ScriptDataStr>())
{
if (!u->str)
{
@@ -285,10 +285,12 @@ void set_scope_reg(ScriptState *st, SIR reg, struct script_data vd)
st->regstrm.insert(reg, u->str);
}
else
- st->regstrm.erase(reg);
+ st->regstrm.insert(reg, conv_str(st, vd));
}
- else if (auto *u = vd.get_if<ScriptDataInt>())
+ else if (auto *u = vd->get_if<ScriptDataInt>())
st->regm.put(reg, u->numi);
+ else
+ st->regm.put(reg, conv_num(st, vd));
}
void set_reg(dumb_ptr<block_list> sd, VariableCode type, SIR reg, int id)