From adf0d0506d653340849f0caf6cb4ec85dea2fd56 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 30 Oct 2008 02:12:16 +0000 Subject: Commit Mantis 519: `pow' function for eAthena scripting --- src/map/script.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/map/script.c') diff --git a/src/map/script.c b/src/map/script.c index 9e476c0..c28467d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -104,6 +104,7 @@ int buildin_close(struct script_state *st); int buildin_close2(struct script_state *st); int buildin_menu(struct script_state *st); int buildin_rand(struct script_state *st); +int buildin_pow(struct script_state *st); int buildin_warp(struct script_state *st); int buildin_areawarp(struct script_state *st); int buildin_heal(struct script_state *st); @@ -333,6 +334,7 @@ struct { {buildin_itemheal,"itemheal","ii"}, {buildin_percentheal,"percentheal","ii"}, {buildin_rand,"rand","i*"}, + {buildin_pow,"pow","ii"}, {buildin_countitem,"countitem","i"}, {buildin_checkweight,"checkweight","ii"}, {buildin_readparam,"readparam","i*"}, @@ -1703,6 +1705,22 @@ int buildin_rand(struct script_state *st) return 0; } +/*========================================== + * + *------------------------------------------ + */ +int buildin_pow(struct script_state *st) +{ + int a, b; + + a = conv_num(st,& (st->stack->stack_data[st->start+2])); + b = conv_num(st,& (st->stack->stack_data[st->start+3])); + + push_val(st->stack, C_INT, (int) pow(a * 0.001, b)); + + return 0; +} + /*========================================== * *------------------------------------------ -- cgit v1.2.3-60-g2f50