summaryrefslogtreecommitdiff
path: root/src/map/script-call.cpp
diff options
context:
space:
mode:
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)