diff options
Diffstat (limited to 'src/map/magic-expr.c')
-rw-r--r-- | src/map/magic-expr.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/map/magic-expr.c b/src/map/magic-expr.c index d22e596..483a9ee 100644 --- a/src/map/magic-expr.c +++ b/src/map/magic-expr.c @@ -1015,6 +1015,13 @@ fun_substr(env_t *env, int args_nr, val_t *result, val_t *args) return 0; } +static int +fun_sqrt(env_t *env, int args_nr, val_t *result, val_t *args) +{ + RESULTINT = (int) sqrt(ARGINT(0)); + return 0; +} + #define BATTLE_RECORD2(sname, name) { sname, "e", 'i', fun_get_##name } #define BATTLE_RECORD(name) BATTLE_RECORD2(#name, name) @@ -1083,6 +1090,7 @@ static fun_t functions[] = { { "strstr", "ss", 'i', fun_strstr }, { "strlen", "s", 'i', fun_strlen }, { "substr", "sii", 's', fun_substr }, + { "sqrt", "i", 'i', fun_sqrt }, { NULL, NULL, '.', NULL } }; |