summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-06-25 20:45:03 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:45:24 -0400
commitc7592866c56e4c5bc2f603c462148ac5cf4fd374 (patch)
tree89d8e87a6ed65a41f61cacc393d380721f39f9c6 /src/map/script-fun.cpp
parente0ab38974d08268fd0bbbae16293afb31686c9f8 (diff)
downloadtmwa-c7592866c56e4c5bc2f603c462148ac5cf4fd374.tar.gz
tmwa-c7592866c56e4c5bc2f603c462148ac5cf4fd374.tar.bz2
tmwa-c7592866c56e4c5bc2f603c462148ac5cf4fd374.tar.xz
tmwa-c7592866c56e4c5bc2f603c462148ac5cf4fd374.zip
allow to get mob/npc params and add more params to readparam
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r--src/map/script-fun.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 8afe4ef..5990e47 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -1676,7 +1676,11 @@ void builtin_freeloop(ScriptState *st)
static
void builtin_bonus(ScriptState *st)
{
- SP type = SP(conv_num(st, &AARG(0)));
+ SP type;
+ if (auto *u = AARG(0).get_if<ScriptDataParam>())
+ type = u->reg.sp();
+ else
+ type = SP(conv_num(st, &AARG(0)));
int val = conv_num(st, &AARG(1));
dumb_ptr<map_session_data> sd = script_rid2sd(st);
pc_bonus(sd, type, val);
@@ -1690,7 +1694,11 @@ void builtin_bonus(ScriptState *st)
static
void builtin_bonus2(ScriptState *st)
{
- SP type = SP(conv_num(st, &AARG(0)));
+ SP type;
+ if (auto *u = AARG(0).get_if<ScriptDataParam>())
+ type = u->reg.sp();
+ else
+ type = SP(conv_num(st, &AARG(0)));
int type2 = conv_num(st, &AARG(1));
int val = conv_num(st, &AARG(2));
dumb_ptr<map_session_data> sd = script_rid2sd(st);
@@ -3291,7 +3299,7 @@ void builtin_get(ScriptState *st)
if (bl == nullptr)
return;
- int var = pc_readparam(bl->is_player(), reg.sp());
+ int var = pc_readparam(bl, reg.sp());
push_int<ScriptDataInt>(st->stack, var);
return;
}